summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2013-01-27 03:11:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-01-27 06:00:40 (GMT)
commitb345d6c3b7517912f1f35f8b235f8a78892d5796 (patch)
tree90a23dac6dfd829d8d67f68d5bcf75b5bc347960 /git-p4.py
parent2abba3014e54920762eb81236e394af7b152f74c (diff)
downloadgit-b345d6c3b7517912f1f35f8b235f8a78892d5796.zip
git-b345d6c3b7517912f1f35f8b235f8a78892d5796.tar.gz
git-b345d6c3b7517912f1f35f8b235f8a78892d5796.tar.bz2
git p4: avoid shell when calling git config
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.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/git-p4.py b/git-p4.py
index 7efa9a8..ff3e8c9 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -560,13 +560,16 @@ def gitBranchExists(branch):
return proc.wait() == 0;
_gitConfig = {}
-def gitConfig(key, args = None): # set args to "--bool", for instance
+
+def gitConfig(key, args=None): # set args to "--bool", for instance
if not _gitConfig.has_key(key):
- argsFilter = ""
- if args != None:
- argsFilter = "%s " % args
- cmd = "git config %s%s" % (argsFilter, key)
- _gitConfig[key] = read_pipe(cmd, ignore_error=True).strip()
+ cmd = [ "git", "config" ]
+ if args:
+ assert(args == "--bool")
+ cmd.append(args)
+ cmd.append(key)
+ s = read_pipe(cmd, ignore_error=True)
+ _gitConfig[key] = s.strip()
return _gitConfig[key]
def gitConfigList(key):