Thread (7 messages) 7 messages, 4 authors, 2016-06-15

Re: config-file includes

flat view

From: Jeff King <hidden>
Date: 2016-06-15 22:52:07

On Mon, Sep 26, 2011 at 09:21:27PM +0200, David Aguilar wrote:
quoted
quoted
   [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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help