Re: [PATCH] Support "core.excludesfile = ~/.gitignore"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 22, 2008, 21:10 UTC
- Message-ID
- <7vsksw92nh.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <quack.20080821T2114.lthvdxtvg7b@roar.cs.berkeley.edu>
Karl Chen <quarl@cs.berkeley.edu> writes:
> Another idea is to have a non-absolute path be interpreted > relative to the location of .gitconfig.
If we were to support relative paths, I think it would be useful and consistent if a relative path found in ".git/config" is relative to the work tree root, in "config" in a bare repository relative to the bare repository, and in "$HOME/.gitconfig" relative to $HOME. I am not sure what a relative path in "/etc/gitconfig" should be relative to, though.
However, this has a technical difficulty. When configuration values are read, the code that knows what the value means does not in general know which configuration file is being read from.
> Below is a sample patch that works for me. We could also use
> getpwuid(getuid()) instead of getenv("HOME") to be consistent with
> user_path() but this is simpler and arguably more likely what the
> user wants when it matters.It is quite likely that somebody would want you to interpret "~name/" if you advertize that you support "~/", so you would need to call getpwuid() eventually if you go down this path. I wonder how this would affect Windows folks.
What are the paths valued configuration variables other than excludesfile that we would want to support? There was a topic to allow mail-aliases lookup for parameters given to the "--author" option today, and send-email takes aliasfile configuration. Because the latter is a script, we would need a "--path" option to "git config" (the idea is similar to existing "--bool" option) so that calling scripts can ask the same "magic" performed to configuration variables' values before being reported.