Skip to content

Commit ef86890

Browse files
Pete Wyckoffgitster
authored andcommitted
git-p4: clone does not use --git-dir
Complain if --git-dir is given during a clone. It has no effect. Only --destination and --bare can change where the newly cloned git dir will be. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 6679c34 commit ef86890

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

contrib/fast-import/git-p4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2335,7 +2335,8 @@ def main():
23352335
args = sys.argv[2:]
23362336

23372337
if len(options) > 0:
2338-
options.append(optparse.make_option("--git-dir", dest="gitdir"))
2338+
if cmd.needsGit:
2339+
options.append(optparse.make_option("--git-dir", dest="gitdir"))
23392340

23402341
parser = optparse.OptionParser(cmd.usage.replace("%prog", "%prog " + cmdName),
23412342
options,

t/t9806-git-p4-options.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
test_description='git-p4 options'
4+
5+
. ./lib-git-p4.sh
6+
7+
test_expect_success 'start p4d' '
8+
start_p4d
9+
'
10+
11+
test_expect_success 'init depot' '
12+
(
13+
cd "$cli" &&
14+
echo file1 >file1 &&
15+
p4 add file1 &&
16+
p4 submit -d "change 1" &&
17+
echo file2 >file2 &&
18+
p4 add file2 &&
19+
p4 submit -d "change 2" &&
20+
echo file3 >file3 &&
21+
p4 add file3 &&
22+
p4 submit -d "change 3"
23+
)
24+
'
25+
26+
test_expect_success 'clone no --git-dir' '
27+
test_must_fail "$GITP4" clone --git-dir=xx //depot
28+
'
29+
30+
test_expect_success 'kill p4d' '
31+
kill_p4d
32+
'
33+
34+
test_done

0 commit comments

Comments
 (0)