Re: Possible bug in includeIf / conditional includes
- From
Raphael Stolt <raphael.stolt@gmail.com>
- Date
- May 10, 2017, 21:21 UTC
- Message-ID
- <CC77A0CE-88A5-4A3C-97AF-ED0180FE385B@gmail.com>
- In-Reply-To
- <CACBZZX7CgeW1OK+g9Mbir62MMaCx4sHFZngUuWz_H241Sb355g@mail.gmail.com>
Show 9 quoted lines
> > Am 10.05.2017 um 21:48 schrieb Ævar Arnfjörð Bjarmason <avarab@gmail.com>: > > On Wed, May 10, 2017 at 8:58 PM, Sebastian Schuberth > <sschuberth@gmail.com> wrote: >> On 2017-05-10 19:00, raphael.stolt@gmail.com wrote: >> >>> Current configuration which finds the conditional configuration. >>>
a)
Show 6 quoted lines
>>> ~/.gitconfig >>> [includeIf "gitdir:~/Work/git-repos/oss/"] >>> path = ~/Work/git-repos/oss/.oss-gitconfig >>> >>> Expected configuration which doesn't find the conditional configuration: >>>
b)
Show 16 quoted lines
>>> ~/.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.
Show 16 quoted lines
> > ---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