Re: Possible bug in includeIf / conditional includes
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- May 10, 2017, 19:48 UTC
- Message-ID
- <CACBZZX7CgeW1OK+g9Mbir62MMaCx4sHFZngUuWz_H241Sb355g@mail.gmail.com>
- In-Reply-To
- <b80c68fa-fe1e-3cf8-3c7e-527a4d941108@gmail.com>
On Wed, May 10, 2017 at 8:58 PM, Sebastian Schuberth <sschuberth@gmail.com> wrote:
Show 18 quoted lines
> On 2017-05-10 19:00, raphael.stolt@gmail.com wrote: > >> 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 > > > 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):
---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.