mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Cache the per-user configuration to avoid duplicate instances
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
7965f9fed0
commit
90be5c0839
@ -28,9 +28,13 @@ def IsId(rev):
|
|||||||
|
|
||||||
|
|
||||||
class GitConfig(object):
|
class GitConfig(object):
|
||||||
|
_ForUser = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ForUser(cls):
|
def ForUser(cls):
|
||||||
return cls(file = os.path.expanduser('~/.gitconfig'))
|
if cls._ForUser is None:
|
||||||
|
cls._ForUser = cls(file = os.path.expanduser('~/.gitconfig'))
|
||||||
|
return cls._ForUser
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def ForRepository(cls, gitdir, defaults=None):
|
def ForRepository(cls, gitdir, defaults=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user