From: Jeff King Date: Mon, 26 Sep 2011 20:05:53 GMT Subject: Re: config-file includes Message-ID: <20110926200553.GA492@sigill.intra.peff.net> 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