Possible bug in referenced configuration file loading
Configuration for global ignore patterns in ~/.config/git/config: [core] excludesfile = .gitignore doesn't get looked up per default in ~/.config/git/ which might be considered a bug as the .gitignore file isn't loaded. It's only loaded when .gitignore is located in $HOME or explicitly referenced via ~/.config/git/.gitignore. Configuration for a conditional include also in ~/.config/git/config: [includeIf "gitdir:~/Work/git-repos/"] path = .oss-gitconfig does get looked up per default in ~/.config/git/ and therefor the .oss-gitconfig is loaded. So there seems to be a difference in Git's configuration loading strategies. Environment details: macOS High Sierra git version 2.19.1 Windows 10 git version 2.16.1.windows.2
Possible bug in includeIf / conditional includes on non git initialised directories
Hi there, I might have stumbled this time over a real bug in includeIf / conditional includes or maybe it's just as intended. 1) Given I have a correct configured includeIf and I’m issuing `git config --show-origin --get user.email` against an directory which hasn’t been `git init`ed I get the user.email configured globally. 2) Given I have a correct configured includeIf and I’m issuing `git config --show-origin --get user.email` against an directory which has been `git init`ed I get the user.email configured conditionally. For 1) I would probably expect to get the user.email configured conditionally even for a plain directory. More details see this (http://stackoverflow.com/questions/43919191/git-2-13-conditional-config-on-windows/) Stack Overflow question. Best regards, Raphael Stolt
Re: Possible bug in includeIf / conditional includes
> Am 10.05.2017 um 23:21 schrieb Raphael Stolt : > >> >> Am 10.05.2017 um 21:48 schrieb Ævar Arnfjörð Bjarmason : >> >> On Wed, May 10, 2017 at 8:58 PM, Sebastian Schuberth >> wrote: >>> On 2017-05-10 19:00, raphael.st...@gmail.com wrote: >>> >>>> Current configuration which finds the conditional configuration. >>>> > > a) > >>>> ~/.gitconfig >>>> [includeIf "gitdir:~/Work/git-repos/oss/"] >>>> path = ~/Work/git-repos/oss/.oss-gitconfig >>>> >>>> Expected configuration which doesn't find the conditional configuration: >>>> > > b) > >>>> ~/.gitconfig >>>> [includeIf "gitdir:~/Work/git-repos/oss/"] >>>> path = .oss-gitconfig >>> >>> >>> My guess is, because includeIf might contain other conditionals than >>> "gitdir", the generic convention is to always use an absolute path for >>> "path". >> >> [CC'd OP Raphael Stolt, please reply-all] >> >> In both cases the conditional is the same, but the path is relative >> v.s. absolute. >> >> Raphael: Does the config get included if you cd to >> ~/Work/git-repos/oss/? From git-config(1): > > Given I’m in a repo in ~/Work/git-repos/oss/ e.g. > ~/Work/git-repos/oss/project-repo-a and I’m using config a) > the config is used from ~/Work/git-repos/oss/.oss-gitconfig > > Given I’m in a repo in ~/Work/git-repos/oss/ e.g. > ~/Work/git-repos/oss/project-repo-a and I’m using config b) > the global config is used because there is no .oss-gitconfig in $HOME. Given I’m in ~/Work/git-repos/oss and I’m using config b) also the global config (~/.gitconfig) is used. > > I guess it’s an intended behavior since conditional configuration files > __SHOULD__ reside in $HOME rather than > in my case in ~/Work/git-repos/oss. > >> >> ---cut--- >> The included file is expanded immediately, as if its contents had been >> found at the location of the include directive. If the value of the >> `include.path` variable is a relative path, the path is considered to >> be relative to the configuration file in which the include directive >> was found. See below for examples. >> ---cut--- >> >> The commit that added IncludeIf (3efd0bedc6) does something with >> relative path (just skimming, need to get to other things), but unlike >> [Include] the docs don't explicitly mention what it's supposed to do >> with that, and all the examples show absolute paths. >> >> So whether this is a bug in the code or not it seems to definitely be >> a doc bug, whatever it does with relative files should be in the docs. > + 1
Re: Possible bug in includeIf / conditional includes
> > Am 10.05.2017 um 21:48 schrieb Ævar Arnfjörð Bjarmason : > > On Wed, May 10, 2017 at 8:58 PM, Sebastian Schuberth > wrote: >> On 2017-05-10 19:00, raphael.st...@gmail.com wrote: >> >>> Current configuration which finds the conditional configuration. >>> a) >>> ~/.gitconfig >>> [includeIf "gitdir:~/Work/git-repos/oss/"] >>> path = ~/Work/git-repos/oss/.oss-gitconfig >>> >>> Expected configuration which doesn't find the conditional configuration: >>> b) >>> ~/.gitconfig >>> [includeIf "gitdir:~/Work/git-repos/oss/"] >>> path = .oss-gitconfig >> >> >> My guess is, because includeIf might contain other conditionals than >> "gitdir", the generic convention is to always use an absolute path for >> "path". > > [CC'd OP Raphael Stolt, please reply-all] > > In both cases the conditional is the same, but the path is relative > v.s. absolute. > > Raphael: Does the config get included if you cd to > ~/Work/git-repos/oss/? From git-config(1): Given I’m in a repo in ~/Work/git-repos/oss/ e.g. ~/Work/git-repos/oss/project-repo-a and I’m using config a) the config is used from ~/Work/git-repos/oss/.oss-gitconfig Given I’m in a repo in ~/Work/git-repos/oss/ e.g. ~/Work/git-repos/oss/project-repo-a and I’m using config b) the global config is used because there is no .oss-gitconfig in $HOME. I guess it’s an intended behavior since conditional configuration files __SHOULD__ reside in $HOME rather than in my case in ~/Work/git-repos/oss. > > ---cut--- > The included file is expanded immediately, as if its contents had been > found at the location of the include directive. If the value of the > `include.path` variable is a relative path, the path is considered to > be relative to the configuration file in which the include directive > was found. See below for examples. > ---cut--- > > The commit that added IncludeIf (3efd0bedc6) does something with > relative path (just skimming, need to get to other things), but unlike > [Include] the docs don't explicitly mention what it's supposed to do > with that, and all the examples show absolute paths. > > So whether this is a bug in the code or not it seems to definitely be > a doc bug, whatever it does with relative files should be in the docs. + 1
Possible bug in includeIf / conditional includes
Hi there, I might have stumbled over a bug in includeIf / conditional includes or maybe it's just as intended. Current configuration which finds the conditional configuration. ~/.gitconfig [includeIf "gitdir:~/Work/git-repos/oss/"] path = ~/Work/git-repos/oss/.oss-gitconfig Expected configuration which doesn't find the conditional configuration: ~/.gitconfig [includeIf "gitdir:~/Work/git-repos/oss/"] path = .oss-gitconfig Best regards, Raphael Stolt