Skip to content

Commit

Permalink
git-p4: Cache git config for performance
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
John Chapman authored and Junio C Hamano committed Nov 11, 2008
1 parent 7f96e2e commit 36bd844
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down

0 comments on commit 36bd844

Please sign in to comment.