-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Conditional includes in .gitconfig not supported #12041
Comments
Thanks for the report @ferenczy. I did test out conditional includes last year (and it worked), but that was prior to us shipping various config improvements (#11595 and #11591). @sergiou87 should have some thoughts about this since he worked on that feature. |
Thank you for bringing this up @ferenczy! ❤️ I just checked and the problem seems to be we're running We'll look into this and let you know 😄 |
Thanks for your replies guys! @sergiou87 You're right, I have tested it on my machine with the same results. I was afraid that you may be using some Git library that doesn't support the conditional includes, so it may be complicated to fix, but this looks pretty easy to fix to me. Should I take a look and possibly create a PR? Or am I just too naive? 🙂 Also, those conditional includes are configured for a specific directory so it makes sense to me to read them with the repository configuration rather than the global configuration, i.e. using |
I think it should be easy to do, yeah. Please go ahead and submit a PR if you feel comfortable to do so! I'll assign the issue to you 😄 Just FYI those values will be read-only, you won't be able to change them from the app, only see them when you open the Repository settings. We assume that if a user set up such an unusual config structure, they know what they're doing 😅 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@sergiou87 OK, I'll take a look at it. Is it just about changing command-line options of the Git command the GitHub desktop is executing or should I expect more changes, please. I mean, is it possible it will have any consequences/side-effects? @HadesStyx Were those questions addressed to me? If so, I don't understand what you're asking, I'm afraid. 🙂 |
@ferenczy yeah, it should be just that… but as everything, it might have unexpected consequences or side-effects 😂 I think the idea would be trying to keep the changes to only affect the Repository Settings screen, if possible. Also, don't worry about HadesStyx, those were just random comments. We get a bunch of those every day 😅 |
@sergiou87 @ferenczy , Hi guys any progress on this? I ran into this issue today as well. The display on GitHub Desktop doesn't truly represent the git configurations. |
From #15734:
|
Thanks for copying here. :) |
RE: #12041 (comment)
RE: #12041 (comment)
RE: #12041 (comment)
From a quick search of the codebase for All of https://github.com/desktop/desktop/blob/development/app/src/lib/git/config.ts#L5-L29 https://github.com/desktop/desktop/blob/development/app/src/lib/git/config.ts#L154-L175 There also seems to be a desktop/app/src/lib/git/config.ts Lines 177 to 187 in 6aa1e09
And desktop/app/src/lib/git/config.ts Lines 204 to 219 in 6aa1e09
|
Describe the bug
The GitHub Desktop client doesn't support .gitconfig's Conditional includes.
I'm using a single machine for both work and private development. Each of those requires a distinct Git user (name and email). I don't want to configure the Git user for each and every repository individually (as I usually forget to do so and notice it when there're several commits under a wrong user already). That's why I'm using the Conditional includes. That allows me to have an individual configuration for a specific directory and all its subdirectories, for example:
~/development/
for personal projects with a personal user name/email~/work/
for projects I'm working on in my jobMy base
~/.gitconfig
contains something like the following:The content of
~/.gitconfig-work
:And that's it. All repositories under the directory
~/work/
will be using the configuration from the base~/.gitconfig
merged with~/.gitconfig-work
(which overwrites anything already defined in the base config). Repositories located anywhere outside of that directory will be using just the configuration from the base config.And Git reflects that. When I execute
git config user.email
under the directory~/work/
or its subdirectories, it prints the e-mail configured in~/.gitconfig-work
.The problem is that GitHub Desktop is always showing the configuration from the base config. When I open the Repository menu > Repository settings... and select Git config, the option Use my global Git config is selected and the name and the email from the base config are shown there. And, of course, it's also used as a commit author.
Version & OS
GitHub 2.7.2
Windows 10 Pro 64-bit
Steps to reproduce the behavior
includeIf
directive (gitdir:...
)git config user.email
in your repositoryExpected behavior
GitHub Desktop behaves consistently with the official CLI Git client. Also, for example, SourceTree behaves correctly.
Actual behavior
The Conditional includes are ignored by GitHub Desktop.
The text was updated successfully, but these errors were encountered: