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

Re: [PATCH 1/2] Add possibility to store configuration in ~/.config/git/config file

From
Junio C Hamano <gitster@pobox.com>
Date
May 25, 2012, 21:25 UTC
Message-ID
<7vd35sq7fx.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120525203056.GC4364@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
> On Fri, May 25, 2012 at 09:47:18PM +0200, NGUYEN Huynh Khoi Nguyen wrote:
>
>> git will store its configuration in ~/.config/git/config file if this file
>> exists and ~/.gitconfig file doesn't, otherwise git store its configuration
>> in ~/.gitconfig as usual
>
> What about reading? For maximum compatibility, we should always read
> from _both_ of them, and choose between them only when writing, no? It
> looks like your patch will only read from one or the other.
>
> At first people will have only one or the other, but people using
> multiple versions of git, or people following already-written
> instructions on the web about modifying ~/.gitconfig could end up with
> both.
Isn't it actually much worse than that?

If you read from .gitconfig and also from the new location, but update only the new location, people who use two versions of git will be in a very confusing situation. Randomly, some of their updates are always in effect, and others only appear sometimes, and after wasting a lot of time and hair scratching their heads, they will realize that writing with old versions of Git will store values to a place visible to both versions, while writing with new versions will store values to a place visible only to new versions.

I'd rather see it ignore the new location as long as ~/.gitconfig exists (and if only the new location exists, read from and write to it), and have users make a conscious decision to transition. That is:

 - If ~/.gitconfig exists, do not do anything new.  Just exercise the
   original code.  For these users, ~/.config/ does _not_ exist as far as
   Git is concerned.
 - (optional) If ~/.gitconfig exists, offer _moving_ it to the new
   location after telling the user to make sure that the user will never
   use older version of git again, and move it if the user agrees.
 - Otherwise, read from and write to the new location.
Previous: Jeff KingNext: Jeff King
Message 4 of 12 in “Add possibility to store configuration in ~/.config/git/config file”
  1. 1/2 Add possibility to store configuration in ~/.config/git/config fileNGUYEN Huynh Khoi Nguyen, May 25, 2012
  2. 2/2 Test File Name: t1306-second-config-file.shNGUYEN Huynh Khoi Nguyen, May 25, 2012
  3. Jeff KingMay 25, 2012
  4. Junio C HamanoMay 25, 2012
  5. Jeff KingMay 25, 2012
  6. Nguyen Thai Ngoc DuyMay 26, 2012
  7. Jeff KingMay 26, 2012
  8. David AguilarMay 28, 2012
  9. Matthieu MoyMay 26, 2012
  10. jaseem abidMay 25, 2012
  11. Matthieu MoyMay 26, 2012
  12. Jeff KingMay 26, 2012

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.