Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support includeIf' hasconfig:remote.*.url condition #6641

Open
gdetrez opened this issue Oct 6, 2023 · 3 comments
Open

Support includeIf' hasconfig:remote.*.url condition #6641

gdetrez opened this issue Oct 6, 2023 · 3 comments

Comments

@gdetrez
Copy link

gdetrez commented Oct 6, 2023

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

@ethomson
Copy link
Member

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

@davidandreoletti
Copy link

davidandreoletti commented Feb 7, 2024

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

@maartenc
Copy link

Same issue in TortoiseGit, which relies on libgit2.

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

No branches or pull requests

4 participants