Skip to content

Commit

Permalink
git-p4: Fix checkout bug when using --import-local.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tor Arvid Lund authored and Junio C Hamano committed Aug 29, 2008
1 parent 61c5d43 commit e990501
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit e990501

Please sign in to comment.