From 36bd844658cf244ec2c6756c18673a4b7ed8ec9e Mon Sep 17 00:00:00 2001 From: John Chapman Date: Sat, 8 Nov 2008 14:22:49 +1100 Subject: [PATCH] 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 --- contrib/fast-import/git-p4 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index 38d1a17333..9f0a5f92c1 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 = {}