Merged
Conversation
In order to support config includes, we must differentiate between the backend's main file and the file we are currently parsing. This lays the groundwork for includes, keeping the current behaviours.
src/config_file.c
Outdated
Member
There was a problem hiding this comment.
What is this !/ syntax? I don't think git will respect home directories in include.path at all, but if it did, I would expect it to use ~.
Member
Author
There was a problem hiding this comment.
It's meant to be ~/ which git uses. Now I'm terribly confused as to why the tests work.
Member
|
As the person who inflicted |
Member
Author
|
The issues should be resolved now. |
Relative, absolute and home-relative paths are supported. The recursion limit it set at 10, just like in git.
When refreshing we need to refresh if any of the files have been touched, so we need to keep the list.
We need to refresh the variables from the included files if they are changed, so loop over all included files and re-parse the files if any of them has changed.
When two or more variables of the same name exist and the user asks for a scalar, we must return the latest value assign to it.
As the include depth increases, the chance of a realloc increases. This means that whenever we run git_array_alloc() or call config_parse(), we need to remember what our reader's index is so we can look it up again.
Member
|
Alright, this looks as good as this abomination can look. Que Dios nos pille confesados... |
phatblat
pushed a commit
to phatblat/libgit2
that referenced
this pull request
Sep 13, 2014
Support config includes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should handle #1646. As a bonus, we now actually handle overriding variables correctly.
What we don't currently support is the
~user/filestyle (we do support~/file) but I don't think that's a big deal (and we'd need to figure out what to do on Windows) so I'm sending this now and we can add that later.git-configallows you to look up or list variables without following the includes. It's not clear how we'd support this API-wise (as we'd need an extra param or something), so that's not here either.Everything else works.