From: John Chapman Date: Sat, 8 Nov 2008 03:22:49 +0000 (+1100) Subject: git-p4: Cache git config for performance X-Git-Tag: v1.6.1-rc1~69 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=36bd844658cf244ec2c6756c18673a4b7ed8ec9e;p=git.git git-p4: Cache git config for performance This makes git-p4 noticibly faster on Windows. Signed-off-by: John Chapman Acked-by: Simon Hausmann Signed-off-by: Junio C Hamano --- diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index 38d1a1733..9f0a5f92c 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -316,8 +316,11 @@ def gitBranchExists(branch): stderr=subprocess.PIPE, stdout=subprocess.PIPE); return proc.wait() == 0; +_gitConfig = {} def gitConfig(key): - return read_pipe("git config %s" % key, ignore_error=True).strip() + if not _gitConfig.has_key(key): + _gitConfig[key] = read_pipe("git config %s" % key, ignore_error=True).strip() + return _gitConfig[key] def p4BranchesInGit(branchesAreInRemotes = True): branches = {}