sublime_merge
sublime_merge copied to clipboard
Conditional Include Not Working on Windows(?)
Version info
- OS: Windows 10
- Build: 2063
Description
I'm using conditional git configs for my work directories, but it seems like they aren't working at all.
I found the other issue (#502) and trying their reproduction does not work for me.
Steps to reproduce
Steps to reproduce the behavior:
- Remove any user info from global git config
- Add a conditional include for an adjacent file e.g.
C:\Users\user\.gitconfig
[includeif "gitdir/ig:C:/Users/user/work/"]
path = C:/Users/user/work/.gitconfig
- Add user info into said gitconfig
[user]
name = User Name
email = [email protected]
- Confirm config works by running
git --list --show-originin a git repo insidework - See new config not reflected in Merge for opened repos in the
workfolder
Expected behavior
Merge to resolve the same user settings as git does
Extras
git config --list --show-origin
...
file:C:/Users/bq/.gitconfig include.path=C:/Users/bq/.gitconfig.default
file:C:/Users/bq/.gitconfig.default user.name=Adam
file:C:/Users/bq/.gitconfig.default [email protected]
file:C:/Users/bq/.gitconfig includeif.gitdir:C:/dev/izettle/.path=C:/dev/izettle/.gitconfig
file:C:/dev/izettle/.gitconfig user.name=Adam Haglund
file:C:/dev/izettle/.gitconfig [email protected]
...

I have this problem too.
Versions:
- Sublime Merge
2076 - Git
2.37.3.windows.1
Conditional configs are set like this:
[includeIf "gitdir/i:d:/code/"]
path = .gitconfig-retif
[includeIf "gitdir/i:d:/work/"]
path = .gitconfig-work
Where all the configs are located:
c:\Documents and Settings\retif\.gitconfig
c:\Documents and Settings\retif\.gitconfig-work
c:\Documents and Settings\retif\.gitconfig-retif
And git config --list --show-origin executed inside a repository does report that correct [user] credentials are fetched from the corresponding conditional config.
Sadly, Sublime Merge doesn't get those:

I'm also seeing this exact same issue under Windows on Sublime Merge 2079
It looks like other configs such as [http] are functioning correctly. But perhaps that's just because they're picked up directly by git. I too see the expected name/email from the conditional config when using git config --list --show-origin. But when I try to commit in Sublime Merge I get the Edit User dialog box.
I've been doing some experimenting and have identified a work around. Adding a dummy name and password before the conditional statements keeps Sublime Merge happy and it will let you commit. When the commit is carried out by git, the correct name and email are obtained using the conditional statements. When drafting your commit it will say - <-> but once its committed the correct details will be down for the Author.
[user]
email = -
name = -
[includeIf "gitdir/i:C:/git/personal/"]
path = C:/git/.gitconfig-personal
[includeIf "gitdir/i:C:/git/work/"]
path = C:/git/.gitconfig-work