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
1 changed files with 5 additions and 1 deletions
|
@ -28,9 +28,13 @@ def IsId(rev):
|
|||
|
||||
|
||||
class GitConfig(object):
|
||||
_ForUser = None
|
||||
|
||||
@classmethod
|
||||
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
|
||||
def ForRepository(cls, gitdir, defaults=None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue