Re: Possible bug in includeIf / conditional includes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 10, 2017 at 09:48:05PM +0200, Ævar Arnfjörð Bjarmason wrote:

> 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):

That shouldn't matter for relative paths in the "path" value; they're
never based on the cwd.  E.g., with this setup:

  export HOME=$PWD
  git config -f .gitconfig foo.bar "base value"
  git config -f .gitconfig includeIf."gitdir:$PWD/repo/".path included
  git config -f included foo.bar "HOME include"
  git init -q repo && cd repo
  git config -f included foo.bar "working tree include"
  git config -f .git/included foo.bar "GIT_DIR include"
  git config foo.bar

Looking at foo.bar should always give you one of

  HOME include - if you are in the repo that matches the includeIf
  base value - if you are not

but never the "working tree" or "GIT_DIR" includes.

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

The includeIf variables should behave exactly as the documentation you
quoted above. The conditional impacts whether we respect the keys in
that section, but not the meaning of the keys.

I thought that was clear, but as somebody who was involved in the
development of both the original and the conditional includes, my
opinion probably doesn't count. I wouldn't mind a patch to make that
more explicit in the documentation.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]