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

Re: config-file includes

From
David Aguilar <davvid@gmail.com>
Date
Sep 26, 2011, 19:21 UTC
Message-ID
<20110926192126.GA55743@gmail.com>
In-Reply-To
<CACsJy8BAVRAct=sxTpZ+b-ft1OjbY9oZG6uEXrcsTXw3CXnwSg@mail.gmail.com>
On Mon, Sep 26, 2011 at 08:45:58PM +1000, Nguyen Thai Ngoc Duy wrote:
Show 21 quoted lines
> On Sat, Sep 24, 2011 at 5:58 AM, Jeff King <peff@peff.net> wrote:
> 
> Another thing is, what if I want to exclude certain part of the included config?
> 
> [1] http://thread.gmane.org/gmane.comp.version-control.git/163285/focus=163288
> 
> > [1] I want conditional inclusion because sometimes the rules for config
> >    entries changes from version to version. For example, I have
> >    pager.diff set to a script in my ~/.gitconfig. But older versions of
> >    git don't understand non-boolean values and barf. I'd really like to
> >    do something like:
> >
> >    [include-ifdef "has-pager-scripts"]
> >    path = ~/.gitconfig-pager
> >
> >    where "has-pager-scripts" would be a magic flag compiled into git
> >    versions that understand that config.
> 
> But how far would you go with conditional expressions?
> -- 
> Duy

This syntax is simple yet would solve one problem I run into often. It could be used for the case where some settings (e.g. diff.tool, merge.tool) are different on OS X and Linux.

[include-ifdef "darwin"]
	path = ~/.gitconfig-darwin
-- 
					David
Previous: Jeff KingNext: Jeff King
Message 4 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.