From f841ca48c150e8a62728c5875fb01dcf7c5756a7 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 18 Feb 2020 21:31:51 -0500 Subject: git_config: add support for repo-specific settings This allows people to write ~/.repoconfig/config akin to ~/.gitconfig and .repo/config akin to .git/config. This allows us to add settings specific to repo without mixing up git, and to persist in general. Change-Id: I1c6fbe31e63fb8ce26aa85335349c6ae5b1712c6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255832 Reviewed-by: David Pursehouse Tested-by: Mike Frysinger --- git_config.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'git_config.py') diff --git a/git_config.py b/git_config.py index 6b1f7107..8c4efac8 100644 --- a/git_config.py +++ b/git_config.py @@ -88,10 +88,12 @@ def _key(name): class GitConfig(object): _ForUser = None + _USER_CONFIG = '~/.gitconfig' + @classmethod def ForUser(cls): if cls._ForUser is None: - cls._ForUser = cls(configfile=os.path.expanduser('~/.gitconfig')) + cls._ForUser = cls(configfile=os.path.expanduser(cls._USER_CONFIG)) return cls._ForUser @classmethod @@ -373,6 +375,12 @@ class GitConfig(object): GitError('git config %s: %s' % (str(args), p.stderr)) +class RepoConfig(GitConfig): + """User settings for repo itself.""" + + _USER_CONFIG = '~/.repoconfig/config' + + class RefSpec(object): """A Git refspec line, split into its components: -- cgit v1.2.3-54-g00ecf