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

Conditional include not working #502

Closed
pasnox opened this issue May 23, 2019 · 5 comments
Closed

Conditional include not working #502

pasnox opened this issue May 23, 2019 · 5 comments

Comments

@pasnox
Copy link

pasnox commented May 23, 2019

Version info

  • OS: Linux (KaOS)
  • Build: 1107

Description

Conditional include is not working

Steps to reproduce

Steps to reproduce the behavior:

  1. Create global git config

[include]
path = /.gitconfig.default
[includeIf "gitdir:
/Projects/Work/"]
path = /.gitconfig.work
[includeIf "gitdir:
/Projects/Personal/"]
path = ~/.gitconfig.pasnox

  1. Create and fill .gitconfig.default, work and pasnox
    The default is just blanking name and email like this:

[user]
name =
email =

  1. Try to commit something from Sublime Merge
  2. It does not show any user information and then propose to fill user/email on commit

Expected behavior

It should show my user info from conditional include

Screenshots

image

=== Git Version Information ===
Using Git: git (system)
git version 2.21.0
PATH: /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/pasnox/Applications

=== Browse Page Information ===
HEAD: bbbbda5be7b61296c7a068356ec13bcf2684486f
Is in merge: 0
Is in cherry_pick: 0
Is in rebase: 0
Is in revert: 0

=== Git Config Information ===
alias.ann=blame
alias.ci=commit
alias.co=checkout
alias.di=diff
alias.opush-42=push origin HEAD:refs/for/4.2
alias.opush-43=push origin HEAD:refs/for/4.3
alias.opush-44=push origin HEAD:refs/for/4.4
alias.opush-45=push origin HEAD:refs/for/4.5
alias.opush-46=push origin HEAD:refs/for/4.6
alias.opush-510=push origin HEAD:refs/for/5.10
alias.opush-511=push origin HEAD:refs/for/5.11
alias.opush-512=push origin HEAD:refs/for/5.12
alias.opush-dev=push origin HEAD:refs/for/dev
alias.opush-m=push origin HEAD:refs/for/master
alias.st=status
branch.master.merge=refs/heads/master
branch.master.rebase=true
branch.master.remote=origin
core.bare=false
core.filemode=true
core.logallrefupdates=true
core.precomposeunicode=true
core.repositoryformatversion=0
credential.helper=cache --timeout=604800
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.smudge=git-lfs smudge -- %f
include.path=/.gitconfig.default
includeif.gitdir:
/Projects/Work/.path=/.gitconfig.work
includeif.gitdir:
/Projects/Personal/.path=~/.gitconfig.pasnox
remote.origin.fetch=+refs/heads/:refs/remotes/origin/
rerere.autoupdate=true
rerere.enabled=true
user.email=filipe.azevedo@work.com
user.name=Filipe Azevedo

=== Our Config Information ===
Git Config Path Information
Using config path: /usr/etc/gitconfig
Using config path: /home/pasnox/.config/git/config
Using config path: /home/pasnox/.gitconfig
Using config path: /home/pasnox/Projects/Work/Customer/customer_foo/.git/config

Our config output is different to the Git config output
alias.ann=blame
alias.ci=commit
alias.co=checkout
alias.di=diff
alias.opush-42=push origin HEAD:refs/for/4.2
alias.opush-43=push origin HEAD:refs/for/4.3
alias.opush-44=push origin HEAD:refs/for/4.4
alias.opush-45=push origin HEAD:refs/for/4.5
alias.opush-46=push origin HEAD:refs/for/4.6
alias.opush-510=push origin HEAD:refs/for/5.10
alias.opush-511=push origin HEAD:refs/for/5.11
alias.opush-512=push origin HEAD:refs/for/5.12
alias.opush-dev=push origin HEAD:refs/for/dev
alias.opush-m=push origin HEAD:refs/for/master
alias.st=status
branch.master.merge=refs/heads/master
branch.master.rebase=true
branch.master.remote=origin
core.bare=false
core.filemode=true
core.logallrefupdates=true
core.precomposeunicode=true
core.repositoryformatversion=0
credential.helper=cache --timeout=604800
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.smudge=git-lfs smudge -- %f
include.path=/.gitconfig.default
includeif.gitdir:
/Projects/Work/.path=/.gitconfig.work
includeif.gitdir:
/Projects/Personal/.path=~/.gitconfig.pasnox
remote.origin.fetch=+refs/heads/:refs/remotes/origin/
rerere.autoupdate=true
rerere.enabled=true
user.email=
user.name=

=== Git Attributes Information ===
git check_attr --all output

=== Our Modified Files Newline Normalisation and EOL Information ===

@srbs
Copy link

srbs commented May 23, 2019

@pasnox, I'm thinking that the existence of the properties in the default gitconfig is throwing SM off. As a potential workaround until it's fixed, you might try removing or commenting those lines out.

@pasnox
Copy link
Author

pasnox commented May 23, 2019

Just tested does not help.
What I tried:

  • Commenting name and email in gitconfig.default - does not work
  • Commenting including gitconfig.default - does not works

@BenjaminSchaaf
Copy link
Member

Turns out we weren't handling ~/ paths correctly for includeif. This will be fixed in the next release. In the mean time you can use absolute paths instead, ie. /home/user/Projects/Work/.

@pasnox
Copy link
Author

pasnox commented May 24, 2019

Thanks for the workaround - it works

@srbs
Copy link

srbs commented May 31, 2019

Should be fixed in dev build 1113.

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