Skip to content

BUGFIX: 627 fix include order #628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion git/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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.append(include_path)
include_paths.append(include_path)
num_read_include_files += 1
include_paths.reverse()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this block should be rewritten like this:

files_to_read = include_paths + files_to_read

This makes clearer that included files should be read and merged first.

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
Expand Down