Skip to content

Commit 36bd844

Browse files
arafangiongitster
authored andcommitted
git-p4: Cache git config for performance
This makes git-p4 noticibly faster on Windows. Signed-off-by: John Chapman <[email protected]> Acked-by: Simon Hausmann <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7f96e2e commit 36bd844

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

contrib/fast-import/git-p4

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,11 @@ def gitBranchExists(branch):
316316
stderr=subprocess.PIPE, stdout=subprocess.PIPE);
317317
return proc.wait() == 0;
318318

319+
_gitConfig = {}
319320
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]
321324

322325
def p4BranchesInGit(branchesAreInRemotes = True):
323326
branches = {}

0 commit comments

Comments
 (0)