1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-04 03:06:13 +02:00

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>
This commit is contained in:
Pete Wyckoff 2013-01-26 22:11:23 -05:00 committed by Junio C Hamano
parent 2abba3014e
commit b345d6c3b7

View File

@ -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):