summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 07f050c)
raw | patch | inline | side by side (parent: 07f050c)
author | Pete Wyckoff <pw@padd.com> | |
Sun, 26 Feb 2012 01:06:24 +0000 (20:06 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 27 Feb 2012 00:14:20 +0000 (16:14 -0800) |
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>
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>
Documentation/git-p4.txt | patch | blob | history | |
contrib/fast-import/git-p4 | patch | blob | history | |
t/t9809-git-p4-client-view.sh | patch | blob | history |
index 78938b2930b724f80ebb6c735dba4f6dad719b23..ed827902fc540d098fc548e5bb68ab3ab95ffa25 100644 (file)
--- a/Documentation/git-p4.txt
+++ b/Documentation/git-p4.txt
-----------
The p4 client specification is maintained with the 'p4 client' command
and contains among other fields, a View that specifies how the depot
-is mapped into the client repository. Git-p4 can consult the client
-spec when given the '--use-client-spec' option or useClientSpec
-variable.
+is mapped into the client repository. The 'clone' and 'sync' commands
+can consult the client spec when given the '--use-client-spec' option or
+when the useClientSpec variable is true. After 'git p4 clone', the
+useClientSpec variable is automatically set in the repository
+configuration file. This allows future 'git p4 submit' commands to
+work properly; the submit command looks only at the variable and does
+not have a command-line option.
The full syntax for a p4 view is documented in 'p4 help views'. Git-p4
knows only a subset of the view syntax. It understands multi-line
index 3e1aa276cff93172cb476c54369c35fd255647b8..94f0a12d61ddc01f535615c751daa5800506e0d9 100755 (executable)
self.p4BranchesInGit = []
self.cloneExclude = []
self.useClientSpec = False
+ self.useClientSpec_from_options = False
self.clientSpecDirs = None
if gitConfig("git-p4.syncFromOrigin") == "false":
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:
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):
index c9471d562ddf8e793453f0404db8553f0ec24754..25e01a469dcc262f09d72b6a81549523a210a9b7 100755 (executable)
git_verify "cdir 1/file11" "cdir 1/file12"
'
+#
+# Submit tests
+#
+
+# clone sets variable
+test_expect_success 'clone --use-client-spec sets useClientSpec' '
+ client_view "//depot/... //client/..." &&
+ test_when_finished cleanup_git &&
+ "$GITP4" clone --use-client-spec --dest="$git" //depot &&
+ (
+ cd "$git" &&
+ git config --bool git-p4.useClientSpec >actual &&
+ echo true >true &&
+ test_cmp actual true
+ )
+'
+
#
# Rename directories to test quoting in depot-side mappings
# //depot