Code

git-p4: Fix checkout bug when using --import-local.
authorTor Arvid Lund <torarvid@gmail.com>
Wed, 27 Aug 2008 22:36:12 +0000 (00:36 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 29 Aug 2008 07:15:47 +0000 (00:15 -0700)
When this option is passed to git p4 clone, the checkout at the end would
previously fail. This patch fixes it by optionally creating the master branch
from refs/heads/p4/master, which is the correct one for this option.

Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Acked-By: Simon Hausmann <simon@lst.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/fast-import/git-p4

index c1d24b38f32463b0335cf54071a89a41952ff086..2216cacba79ad7171b7b5abbd1ff27e7b1ef84a1 100755 (executable)
@@ -1748,8 +1748,12 @@ class P4Clone(P4Sync):
         if not P4Sync.run(self, depotPaths):
             return False
         if self.branch != "master":
-            if gitBranchExists("refs/remotes/p4/master"):
-                system("git branch master refs/remotes/p4/master")
+            if self.importIntoRemotes:
+                masterbranch = "refs/remotes/p4/master"
+            else:
+                masterbranch = "refs/heads/p4/master"
+            if gitBranchExists(masterbranch):
+                system("git branch master %s" % masterbranch)
                 system("git checkout -f")
             else:
                 print "Could not detect main branch. No checkout/master branch created."