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

Re: config-file includes

From
Jay Soffian <jaysoffian@gmail.com>
Date
Sep 27, 2011, 02:13 UTC
Message-ID
<CAG+J_Dw3B0qReTevph725sPatpKDzikC=W0XTvKo4GsYLVcL4w@mail.gmail.com>
In-Reply-To
<20110926200553.GA492@sigill.intra.peff.net>
On Mon, Sep 26, 2011 at 4:05 PM, Jeff King <peff@peff.net> wrote:
Show 17 quoted lines
>> [include-ifdef "darwin"]
>>       path = ~/.gitconfig-darwin
>
> Thanks for another concrete example.
>
> I'm not sure how that would be implemented, though. I don't think git
> knows that it is compiled for darwin. Would it just be running "uname
> -s" behind the scenes? Should it happen at runtime, or as part of the
> compile process?
>
> We could allow arbitrary shell code like:
>
>  [include-if "test `uname -s` -eq Darwin"]
>
> Very flexible, though it makes me think we are getting a little
> overboard.  And it's an extra shell invocation whenever we read the
> config, which is ugly.

I would think git could just learn a few useful defines at the time of compile, such as e.g. OS_Darwin would be more than sufficient.

I can also give you another use use case. I keep all my work repos under ~Work/ and I want my user.email on all those to be my work email addy, and all other repos on my system I want to use my personal email address. So my ~/.gitconfig has my personal email address and then 99% of the time I forget to configure the repos under ~/Work correctly. That said, I'm not sure how the config include would help this...

j.
Previous: Junio C HamanoNext: Jeff King
Message 7 of 8 in “config-file includes”
  1. Jeff KingSep 23, 2011
  2. Nguyen Thai Ngoc DuySep 26, 2011
  3. Jeff KingSep 26, 2011
  4. David AguilarSep 26, 2011
  5. Jeff KingSep 26, 2011
  6. Junio C HamanoSep 26, 2011
  7. Jay SoffianSep 27, 2011
  8. Jeff KingSep 27, 2011

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.