config: implement "onbranch" conditional#5196
Merged
ethomson merged 4 commits intolibgit2:masterfrom Aug 27, 2019
Merged
Conversation
Modernize the tests in config::snapshot to make them easier to understand. Most important, include a cleanup function that frees config and snapshot and unlink config files at the end of each test.
Add a few tests that verify some behaviour centered around includes. The first set of tests verifies that we correctly override values depending on the order of includes and other keys, the second set asserts that we can correctly snapshot configuration files with includes.
When assembling contents of the conditionally including file, we use `git_buf_printf` and `git_buf_puts` without checking for error returns. Add `cl_git_pass` to fix this.
With Git v2.23.0, the conditional include mechanism gained another new conditional "onbranch". As the name says, it will cause a file to be included if the "onbranch" pattern matches the currently checked out branch. Implement this new condition and add a bunch of tests.
aa1c3fe to
722ba93
Compare
Contributor
|
Should we wait for Git 2.23 to be released before merging? |
Member
Author
Well, the master branch may hold pre-release code and thus I'd say no, especially considering that git.git has already pulled release candidates containing these new conditions. Furthermore, it's not like there's any change in behaviour for pre-existing repos without explicitly making use of this feature. But I'm biased here due to being the author, so maybe @ethomson should weigh in here. |
Member
Author
|
On Thu, Aug 08, 2019 at 01:09:06AM -0700, Patrick Steinhardt wrote:
> Should we wait for Git 2.23 to be released before merging?
Well, the master branch may hold pre-release code and thus I'd
say no, especially considering that git.git has already pulled
release candidates containing these new conditions.
Furthermore, it's not like there's any change in behaviour for
pre-existing repos without explicitly making use of this
feature.
But I'm biased here due to being the author, so maybe @ethomson
should weigh in here.
Doesn't matter now anymore as v2.23 has been released by now, so
the feature is officially out there :)
|
ethomson
approved these changes
Aug 27, 2019
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.
With Git v2.23.0, the conditional include mechanism gained another new
conditional "onbranch". As the name says, it will cause a file to be
included if the "onbranch" pattern matches the currently checked out
branch.
Implement this new condition and add a bunch of tests.