diff options
author | Pete Wyckoff <pw@padd.com> | 2012-02-25 20:06:24 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-02-26 16:14:20 -0800 |
commit | a93d33ee7bf2f1cd41f94470e9e44e0fc9307046 (patch) | |
tree | 40346569540ff8ea216edbc0fbed2983c6207068 /contrib/fast-import | |
parent | README: point to Documentation/SubmittingPatches (diff) | |
download | tgif-a93d33ee7bf2f1cd41f94470e9e44e0fc9307046.tar.xz |
git-p4: set useClientSpec variable on initial clone
If --use-client-spec was given, set the matching configuration
variable. This is necessary to ensure that future submits
work properly.
The alternatives of requiring the user to set it, or providing
a command-line option on every submit, are error prone.
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/fast-import')
-rwxr-xr-x | contrib/fast-import/git-p4 | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index 3e1aa276cf..94f0a12d61 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -1428,6 +1428,7 @@ class P4Sync(Command, P4UserMap): self.p4BranchesInGit = [] self.cloneExclude = [] self.useClientSpec = False + self.useClientSpec_from_options = False self.clientSpecDirs = None if gitConfig("git-p4.syncFromOrigin") == "false": @@ -2136,7 +2137,11 @@ class P4Sync(Command, P4UserMap): if not gitBranchExists(self.refPrefix + "HEAD") and self.importIntoRemotes and gitBranchExists(self.branch): system("git symbolic-ref %sHEAD %s" % (self.refPrefix, self.branch)) - if not self.useClientSpec: + # accept either the command-line option, or the configuration variable + if self.useClientSpec: + # will use this after clone to set the variable + self.useClientSpec_from_options = True + else: if gitConfig("git-p4.useclientspec", "--bool") == "true": self.useClientSpec = True if self.useClientSpec: @@ -2455,6 +2460,10 @@ class P4Clone(P4Sync): else: print "Could not detect main branch. No checkout/master branch created." + # auto-set this variable if invoked with --use-client-spec + if self.useClientSpec_from_options: + system("git config --bool git-p4.useclientspec true") + return True class P4Branches(Command): |