git-p4: Fix checkout bug when using --import-local.
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>
Tor Arvid Lund committed
Aug 28, 2008 at 00:36 UTC
e990501312e22cfa910d88dc7143bc4eb3632ae1
1 file changed
+6
-2
contrib/fast-import/git-p4
+6
-2
@@ -1748,8 +1748,12 @@ class P4Clone(P4Sync):
1748
if not P4Sync.run(self, depotPaths):
1749
return False
1750
if self.branch != "master":
1751
- if gitBranchExists("refs/remotes/p4/master"):
1752
- system("git branch master refs/remotes/p4/master")
1751
+ if self.importIntoRemotes:
1752
+ masterbranch = "refs/remotes/p4/master"
1753
+ else:
1754
+ masterbranch = "refs/heads/p4/master"
1755
+ if gitBranchExists(masterbranch):
1756
+ system("git branch master %s" % masterbranch)
1757
system("git checkout -f")
1758
else:
1759
print "Could not detect main branch. No checkout/master branch created."