sublime_merge icon indicating copy to clipboard operation
sublime_merge copied to clipboard

Conditional Include Not Working on Windows(?)

Open beeequeue opened this issue 4 years ago • 4 comments

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:

  1. Remove any user info from global git config
  2. 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
  1. Add user info into said gitconfig
[user]
  name = User Name
  email = [email protected]
  1. Confirm config works by running git --list --show-origin in a git repo inside work
  2. See new config not reflected in Merge for opened repos in the work folder

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]
...

image

beeequeue avatar Nov 01 '21 13:11 beeequeue

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:

sm-author

retifrav avatar Sep 10 '22 10:09 retifrav

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.

willz1200 avatar Jan 10 '23 15:01 willz1200

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

willz1200 avatar Jan 10 '23 16:01 willz1200