From 4f77888c3705359a4c5166575e2125177e31fc21 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Sun, 14 May 2017 12:08:33 +0200 Subject: [PATCH 1/2] BUGFIX: Fix include order of config files * Add include files to the beginning to parse them right after the file containing the include directive. * This way more specific config files will overrule the configurations. Resolves: #627 --- git/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/config.py b/git/config.py index 7d962276e..3717bacec 100644 --- a/git/config.py +++ b/git/config.py @@ -424,7 +424,7 @@ def read(self): if include_path in seen or not os.access(include_path, os.R_OK): continue seen.add(include_path) - files_to_read.append(include_path) + files_to_read.insert(0, include_path) num_read_include_files += 1 # each include path in configuration file # end handle includes From 52ea999fce288050fbc2accf297fb8f786e641e9 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Sun, 14 May 2017 12:16:10 +0200 Subject: [PATCH 2/2] BUGFIX: Fix order of included files --- git/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/git/config.py b/git/config.py index 3717bacec..a3ba20a0e 100644 --- a/git/config.py +++ b/git/config.py @@ -410,6 +410,7 @@ def read(self): # Read includes and append those that we didn't handle yet # We expect all paths to be normalized and absolute (and will assure that is the case) if self._has_includes(): + include_paths = [] for _, include_path in self.items('include'): if include_path.startswith('~'): include_path = osp.expanduser(include_path) @@ -424,8 +425,11 @@ def read(self): if include_path in seen or not os.access(include_path, os.R_OK): continue seen.add(include_path) - files_to_read.insert(0, include_path) + include_paths.append(include_path) num_read_include_files += 1 + include_paths.reverse() + for include_path in include_paths: + files_to_read.insert(0, include_path) # each include path in configuration file # end handle includes # END for each file object to read