diff options
author | Tor Arvid Lund <torarvid@gmail.com> | 2011-03-15 13:08:01 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-03-15 16:06:58 -0700 |
commit | 99f790f22e2b2dabf00cf386339e829fe2bac6bc (patch) | |
tree | 6fa1709be8235eb6ab129b110920b3008f316052 | |
parent | Merge branch 'sp/maint-smart-http-sans-100-continue' (diff) | |
download | tgif-99f790f22e2b2dabf00cf386339e829fe2bac6bc.tar.xz |
git-p4: Teach gitConfig method about arguments.
With this patch, it is possible to call the gitConfig method with an optional
argument string, which will be passed to the "git config" executable. For
instance:
gitConfig("core.ignorecase", "--bool")
will ensure that you get the value "true", and won't have to check the returned
value for [1, true, on, yes].
Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | contrib/fast-import/git-p4 | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index 7cb479c5e1..4425220bf6 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -333,9 +333,13 @@ def gitBranchExists(branch): return proc.wait() == 0; _gitConfig = {} -def gitConfig(key): +def gitConfig(key, args = None): # set args to "--bool", for instance if not _gitConfig.has_key(key): - _gitConfig[key] = read_pipe("git config %s" % key, ignore_error=True).strip() + argsFilter = "" + if args != None: + argsFilter = "%s " % args + cmd = "git config %s%s" % (argsFilter, key) + _gitConfig[key] = read_pipe(cmd, ignore_error=True).strip() return _gitConfig[key] def p4BranchesInGit(branchesAreInRemotes = True): |