git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: David Aguilar <davvid@gmail.com>
Cc: Nguyen Thai Ngoc Duy <pclouds@gmail.com>,
	git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>,
	Jay Soffian <jaysoffian@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Jakub Narebski <jnareb@gmail.com>
Subject: Re: config-file includes
Date: Mon, 26 Sep 2011 16:05:53 -0400	[thread overview]
Message-ID: <20110926200553.GA492@sigill.intra.peff.net> (raw)
In-Reply-To: <20110926192126.GA55743@gmail.com>

On Mon, Sep 26, 2011 at 09:21:27PM +0200, David Aguilar wrote:

> > >    [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?
> 
> 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

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.

-Peff

  reply	other threads:[~2011-09-26 20:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23 19:58 config-file includes Jeff King
2011-09-26 10:45 ` Nguyen Thai Ngoc Duy
2011-09-26 12:36   ` Jeff King
2011-09-26 19:21   ` David Aguilar
2011-09-26 20:05     ` Jeff King [this message]
2011-09-26 21:12       ` Junio C Hamano
2011-09-27  2:13       ` Jay Soffian
2011-09-27  2:38         ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110926200553.GA492@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jaysoffian@gmail.com \
    --cc=jnareb@gmail.com \
    --cc=mhagger@alum.mit.edu \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).