summaryrefslogtreecommitdiffstats
path: root/git_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/git_config.py b/git_config.py
index 029beb4d..9ad979ad 100644
--- a/git_config.py
+++ b/git_config.py
@@ -69,8 +69,6 @@ def _key(name):
69class GitConfig(object): 69class GitConfig(object):
70 _ForUser = None 70 _ForUser = None
71 71
72 _USER_CONFIG = '~/.gitconfig'
73
74 _ForSystem = None 72 _ForSystem = None
75 _SYSTEM_CONFIG = '/etc/gitconfig' 73 _SYSTEM_CONFIG = '/etc/gitconfig'
76 74
@@ -83,9 +81,13 @@ class GitConfig(object):
83 @classmethod 81 @classmethod
84 def ForUser(cls): 82 def ForUser(cls):
85 if cls._ForUser is None: 83 if cls._ForUser is None:
86 cls._ForUser = cls(configfile=os.path.expanduser(cls._USER_CONFIG)) 84 cls._ForUser = cls(configfile=cls._getUserConfig())
87 return cls._ForUser 85 return cls._ForUser
88 86
87 @staticmethod
88 def _getUserConfig():
89 return os.path.expanduser('~/.gitconfig')
90
89 @classmethod 91 @classmethod
90 def ForRepository(cls, gitdir, defaults=None): 92 def ForRepository(cls, gitdir, defaults=None):
91 return cls(configfile=os.path.join(gitdir, 'config'), 93 return cls(configfile=os.path.join(gitdir, 'config'),
@@ -415,7 +417,10 @@ class GitConfig(object):
415class RepoConfig(GitConfig): 417class RepoConfig(GitConfig):
416 """User settings for repo itself.""" 418 """User settings for repo itself."""
417 419
418 _USER_CONFIG = '~/.repoconfig/config' 420 @staticmethod
421 def _getUserConfig():
422 repo_config_dir = os.getenv('REPO_CONFIG_DIR', os.path.expanduser('~'))
423 return os.path.join(repo_config_dir, '.repoconfig/config')
419 424
420 425
421class RefSpec(object): 426class RefSpec(object):