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>
Pete Wyckoff committed
Jan 26, 2013 at 22:11 UTC
b345d6c3b7517912f1f35f8b235f8a78892d5796
1 file changed
+9
-6
git-p4.py
+9
-6
@@ -560,13 +560,16 @@ def gitBranchExists(branch):
560
return proc.wait() == 0;
561
562
_gitConfig = {}
563
-def gitConfig(key, args = None): # set args to "--bool", for instance
563
+
564
+def gitConfig(key, args=None): # set args to "--bool", for instance
565
if not _gitConfig.has_key(key):
565
- argsFilter = ""
566
- if args != None:
567
- argsFilter = "%s " % args
568
- cmd = "git config %s%s" % (argsFilter, key)
569
- _gitConfig[key] = read_pipe(cmd, ignore_error=True).strip()
566
+ cmd = [ "git", "config" ]
567
+ if args:
568
+ assert(args == "--bool")
569
+ cmd.append(args)
570
+ cmd.append(key)
571
+ s = read_pipe(cmd, ignore_error=True)
572
+ _gitConfig[key] = s.strip()
573
return _gitConfig[key]
574
575
def gitConfigList(key):