git-p4: Cache git config for performance
This makes git-p4 noticibly faster on Windows. Signed-off-by: John Chapman <thestar@fussycoder.id.au> Acked-by: Simon Hausmann <simon@lst.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
John Chapman committed
Nov 8, 2008 at 14:22 UTC
36bd844658cf244ec2c6756c18673a4b7ed8ec9e
1 file changed
+4
-1
contrib/fast-import/git-p4
+4
-1
@@ -316,8 +316,11 @@ def gitBranchExists(branch):
316
stderr=subprocess.PIPE, stdout=subprocess.PIPE);
317
return proc.wait() == 0;
318
319
+_gitConfig = {}
320
def gitConfig(key):
320
- return read_pipe("git config %s" % key, ignore_error=True).strip()
321
+ if not _gitConfig.has_key(key):
322
+ _gitConfig[key] = read_pipe("git config %s" % key, ignore_error=True).strip()
323
+ return _gitConfig[key]
324
325
def p4BranchesInGit(branchesAreInRemotes = True):
326
branches = {}