diff options
author | Pete Wyckoff <pw@padd.com> | 2013-01-26 22:11:23 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-01-26 22:00:40 -0800 |
commit | b345d6c3b7517912f1f35f8b235f8a78892d5796 (patch) | |
tree | 90a23dac6dfd829d8d67f68d5bcf75b5bc347960 | |
parent | git p4: avoid shell when invoking git config --get-all (diff) | |
download | tgif-b345d6c3b7517912f1f35f8b235f8a78892d5796.tar.xz |
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>
-rwxr-xr-x | git-p4.py | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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): |