Skip to content

Commit e990501

Browse files
torarvidgitster
authored andcommitted
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>
1 parent 61c5d43 commit e990501

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

contrib/fast-import/git-p4

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,8 +1748,12 @@ class P4Clone(P4Sync):
17481748
if not P4Sync.run(self, depotPaths):
17491749
return False
17501750
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)
17531757
system("git checkout -f")
17541758
else:
17551759
print "Could not detect main branch. No checkout/master branch created."

0 commit comments

Comments
 (0)