+4

Add support for Git includeIf.path option

Ricardo Amaral 1 year ago updated 1 year ago 0

SmartGit does not Support includeIf.path introduced with Git v2.13 (released May 2017) and it’s ruining my workflow between my personal and work projects (I use the same laptop).

Using:

[include]
path = ~/.gitconfig-personal

Works just fine, but using:

[includeIf "gitdir/i:~/Workspace/**"]
path = ~/.gitconfig-personal

Does not work at all…

The .gitconfig-personal file includes my e-mail address and when I use SmartGit, since that file is not included when working with a repository inside ~/Workspace/, SmartGit complains of missing e-mail address.

This is a problem with SmartGit because although SmartGit complains about the missing e-mail address, I can still commit and my e-mail address will be added successfully to the commit by git.exe (because git.exe reads the includeIf directive properly, while SmartGit does not).

Also, please take into consideration that if you have a configuration like this:


.gitconfig


[user]
name = Ricardo Amaral
email = name@personal.com

[includeIf "gitdir/i:~/Workspace/Work/**"]
path = ~/.gitconfig-work


.gitconfig-work


[user]
email = name@work.com


The e-mail being used by Git for any folder outside of ~/Workspace/Work/ will be name@personal.com but any Git repository inside ~/Workspace/Work/ will use name@work.com. In other words, after parsing the full Git configuration (taking into consideration "include" and "includeIf" directives), the parameters that precedence (if found duplicates) are the ones on the bottom of the