File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ class Repo(object):
97
97
98
98
# invariants
99
99
# represents the configuration level of a configuration file
100
- config_level = ("system" , "global" , "repository" )
100
+ config_level = ("system" , "user" , " global" , "repository" )
101
101
102
102
def __init__ (self , path = None , odbt = DefaultDBType , search_parent_directories = False ):
103
103
"""Create a new Repo instance
@@ -353,6 +353,13 @@ def _get_config_path(self, config_level):
353
353
354
354
if config_level == "system" :
355
355
return "/etc/gitconfig"
356
+ elif config_level == "user" :
357
+ for evar in ("XDG_CONFIG_HOME" , "HOME" ):
358
+ if evar not in os .environ :
359
+ continue
360
+ return os .path .join (os .environ [evar ], '.config/git/config' )
361
+ # end for each evar to check
362
+ raise AssertionError ("Didn't find a single HOME related environment variable" )
356
363
elif config_level == "global" :
357
364
return os .path .normpath (os .path .expanduser ("~/.gitconfig" ))
358
365
elif config_level == "repository" :
You can’t perform that action at this time.
0 commit comments