]> Pileus Git - ~andy/git/commitdiff
git-p4: clone does not use --git-dir
authorPete Wyckoff <pw@padd.com>
Sun, 25 Dec 2011 02:07:32 +0000 (21:07 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Dec 2011 18:19:30 +0000 (10:19 -0800)
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>
contrib/fast-import/git-p4
t/t9806-git-p4-options.sh [new file with mode: 0755]

index 594980302b634d13029c740d582246eb9ec75a74..dafc4a2c82eb795eb1f5e7eff2998c26760985ea 100755 (executable)
@@ -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,
diff --git a/t/t9806-git-p4-options.sh b/t/t9806-git-p4-options.sh
new file mode 100755 (executable)
index 0000000..8044fb0
--- /dev/null
@@ -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