Skip to content

config: implement "onbranch" conditional#5196

Merged
ethomson merged 4 commits intolibgit2:masterfrom
pks-t:pks/config-include-onbranch
Aug 27, 2019
Merged

config: implement "onbranch" conditional#5196
ethomson merged 4 commits intolibgit2:masterfrom
pks-t:pks/config-include-onbranch

Conversation

@pks-t
Copy link
Member

@pks-t pks-t commented Aug 1, 2019

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.

pks-t added 4 commits August 1, 2019 13:35
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.
@pks-t pks-t force-pushed the pks/config-include-onbranch branch from aa1c3fe to 722ba93 Compare August 1, 2019 13:57
@csware
Copy link
Contributor

csware commented Aug 6, 2019

Should we wait for Git 2.23 to be released before merging?

@pks-t
Copy link
Member Author

pks-t commented Aug 8, 2019

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.

@pks-t
Copy link
Member Author

pks-t commented Aug 27, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants