Re: config-file includes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]