libgit2 icon indicating copy to clipboard operation
libgit2 copied to clipboard

Support includeIf' `hasconfig:remote.*.url` condition

Open gdetrez opened this issue 2 years ago • 3 comments

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

gdetrez avatar Oct 06 '23 10:10 gdetrez

I agree that we should do this, but boy, this is a gnarly change.

ethomson avatar Dec 23 '23 18:12 ethomson

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 :-)

davidandreoletti avatar Feb 07 '24 05:02 davidandreoletti

Same issue in TortoiseGit, which relies on libgit2.

maartenc avatar Feb 19 '24 14:02 maartenc