From: Michael J Gruber Date: Thu, 12 May 2011 14:35:11 GMT Subject: RFC proposal: set git defaults options from config Message-ID: <4DCBF01F.9040009@warpmail.net> In-Reply-To: <20110512082210.GA16813@sigill.intra.peff.net> Mechanism ========= I propose the following mechanism for setting default command line options from the config: options. = is a "multivar" in git-config speak, i.e. it can appear multiple times. When running "git ", our wrapper executes git where is determined by the following rule in pseudocode: if $GIT_OPTIONS_ is unset: := empty else: for in $(git config --get-all options.cmd): if matches the regexp in $GIT_OPTIONS_: append to Examples ======== * By default, no options can be overriden from config (other than those which have config vars already, of course). * A script which wants to protect options "foo" and "bar" of "cmd" from being set by config sets GIT_OPTIONS_CMD="!(foo|bar)". * A script which wants to allow overriding options "foo" and "bar" of "cmd" by config (but nothing else) sets GIT_OPTIONS_CMD="foo|bar" NOTES ===== * This can be done by commit_pager_choice() or by a call right after that in those places. * regexp notation/version to be decided * We should probably do this for long options only (and insert "--" rather than "" to spare the "--" in config). * We should probably do a prefix match. * We could use GIT_OPTIONS__ALLOW and GIT_OPTIONS__DENY rather than rely on negated regexps (if DENY matches deny, otherwise if ALLOW matches allow, otherwise deny). * We can get rid of a few config vars then...and may need to clean up our option names. Taking cover... Michael