Support includeIf' `hasconfig:remote.*.url` condition
Reproduction steps
I tested with the following in my git config:
# ~/.config/git/config
[includeIf "hasconfig:remote.*.url:https://github.com/libgit2/libgit2.git"]
path = ~/.config/git/libgit2.config
# ~/.config/git/libgit2.config
[foo]
bar = baz
Expected behavior
In a repository cloned from the specified remote, the config key foo.bar should have value baz.
$ git clone https://github.com/libgit2/libgit2.git
Cloning into 'libgit2'...
[...]
$ cd libgit2
$ git config foo.bar
baz
Actual behavior
Conditional include doesn't work, foo.bar has no value.
Version of libgit2 (release number or SHA1)
1.7.1 (through rust's git2 crate 0.18.0)
Operating system(s) tested
Linux
I agree that we should do this, but boy, this is a gnarly change.
I agree that we should do this, but boy, this is a gnarly change.
I am a user of gitui, itself relying on libgit2 and would like to highlight why this support is important.
I converted my git user wide config to leverage git's "hasconfig" conditional to set git user.name and found out I can't commit via gitui anymore due to libgit2 lack of "hasconfig" support.
I believe this use case is going to be rather widespread at some point.
Good to know you guys are considering working on it :-)
Same issue in TortoiseGit, which relies on libgit2.