Skip to content

Commit

Permalink
git-p4: clone does not use --git-dir
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pete Wyckoff authored and Junio C Hamano committed Dec 27, 2011
1 parent 6679c34 commit ef86890
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -2335,7 +2335,8 @@ def main():
args = sys.argv[2:]

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

parser = optparse.OptionParser(cmd.usage.replace("%prog", "%prog " + cmdName),
options,
Expand Down
34 changes: 34 additions & 0 deletions t/t9806-git-p4-options.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

test_description='git-p4 options'

. ./lib-git-p4.sh

test_expect_success 'start p4d' '
start_p4d
'

test_expect_success 'init depot' '
(
cd "$cli" &&
echo file1 >file1 &&
p4 add file1 &&
p4 submit -d "change 1" &&
echo file2 >file2 &&
p4 add file2 &&
p4 submit -d "change 2" &&
echo file3 >file3 &&
p4 add file3 &&
p4 submit -d "change 3"
)
'

test_expect_success 'clone no --git-dir' '
test_must_fail "$GITP4" clone --git-dir=xx //depot
'

test_expect_success 'kill p4d' '
kill_p4d
'

test_done

0 comments on commit ef86890

Please sign in to comment.