git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] git-config: git-config --list fixed when GIT_CONFIG value starts with ~/

From
Jeff King <peff@peff.net>
Date
Nov 14, 2014, 20:04 UTC
Message-ID
<20141114200419.GB11581@peff.net>
In-Reply-To
<87vbmh8syq.fsf@gmail.com>
On Sat, Nov 15, 2014 at 01:38:36AM +0600, Alex Kuleshov wrote:
Show 11 quoted lines
> > Yeah, I'd agree it is a little unexpected to expand here. The "~" is
> > mostly a shell thing, and doing:
> >
> >   GIT_CONFIG=~/.gitconfig git config --list
> >
> > from the shell generally works, because the shell will expand the "~"
> > before it even hits git. If you're not using a shell to set the
> > variable, you probably should be pre-expanding it yourself.
> 
> Yes, you're right here, but i put GIT_CONFIG=~/.gitconfig to my .bashrc
> and it doesn't work so.

Weird. It seems to work fine for me (though I admit I only did a pretty cursory test).

Show 7 quoted lines
> > Probably the right place would be the if/else chain around
> > builtin/config.c:514, where we convert a relative path into an absolute
> > one. But I'm not convinced it's a good thing to be doing in the first
> > place.
> >
> What if we'll put path expanding right after getting value of file path,
> after given_config_source.file = getenv(CONFIG_ENVIRONMENT); at 451?

That is a good place to put it if you want to impact $GIT_CONFIG but not "--file". I am not sure if that is sensible. But then, I am not sure that I am convinced that we should be making any change at all.

-Peff
Previous: Alex KuleshovNext: Junio C Hamano
Message 5 of 6 in “git-config: git-config --list fixed when GIT_CONFIG value starts with ~/”
  1. 1/1 git-config: git-config --list fixed when GIT_CONFIG value starts with ~/0xAX, Nov 14, 2014
  2. Eric SunshineNov 14, 2014
  3. Jeff KingNov 14, 2014
  4. Alex KuleshovNov 14, 2014
  5. Jeff KingNov 14, 2014
  6. Junio C HamanoNov 14, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.