summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2013-01-15 00:47:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-01-15 17:46:29 (GMT)
commitc595956db99a728ab2247b564c8283cf5c0d84e6 (patch)
tree5eba33238d85eed1356475e18bb61150be052628 /git-p4.py
parent695d69989429e9268c0587e3606399fc9d6cd6fa (diff)
downloadgit-c595956db99a728ab2247b564c8283cf5c0d84e6.zip
git-c595956db99a728ab2247b564c8283cf5c0d84e6.tar.gz
git-c595956db99a728ab2247b564c8283cf5c0d84e6.tar.bz2
git p4: clone --branch should checkout master
When using the --branch argument to "git p4 clone", one might specify a destination for p4 changes different from the default refs/remotes/p4/master. Both cases should create a master branch and checkout files. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/git-p4.py b/git-p4.py
index 7a0c040..c59ad93 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -3118,17 +3118,15 @@ class P4Clone(P4Sync):
if not P4Sync.run(self, depotPaths):
return False
- if self.branch != "master":
- if self.importIntoRemotes:
- masterbranch = "refs/remotes/p4/master"
- else:
- masterbranch = "refs/heads/p4/master"
- if gitBranchExists(masterbranch):
- system("git branch master %s" % masterbranch)
- if not self.cloneBare:
- system("git checkout -f")
- else:
- print "Could not detect main branch. No checkout/master branch created."
+
+ # create a master branch and check out a work tree
+ if gitBranchExists(self.branch):
+ system([ "git", "branch", "master", self.branch ])
+ if not self.cloneBare:
+ system([ "git", "checkout", "-f" ])
+ else:
+ print 'Not checking out any branch, use ' \
+ '"git checkout -q -b master <branch>"'
# auto-set this variable if invoked with --use-client-spec
if self.useClientSpec_from_options: