From: Michael J Gruber <drmicha@warpmail.net>
To: Jeff King <peff@peff.net>
Cc: Michael J Gruber <git@drmicha.warpmail.net>,
David Pisoni <dpisoni@gmail.com>,
GIt Mailing List <git@vger.kernel.org>,
Git Maintainer <gitster@pobox.com>
Subject: RFC proposal: set git defaults options from config
Date: Thu, 12 May 2011 16:35:11 +0200 [thread overview]
Message-ID: <4DCBF01F.9040009@warpmail.net> (raw)
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.<cmd> = <value>
is a "multivar" in git-config speak, i.e. it can appear multiple times.
When running "git <cmd> <opts>", our wrapper executes
git <cmd> <values> <opt>
where <values> is determined by the following rule in pseudocode:
if $GIT_OPTIONS_<cmd> is unset:
<values> := empty
else:
for <value> in $(git config --get-all options.cmd):
if <value> matches the regexp in $GIT_OPTIONS_<CMD>:
append <value> to <values>
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
"--<value>" rather than "<value>" to spare the "--" in config).
* We should probably do a prefix match.
* We could use GIT_OPTIONS_<CMD>_ALLOW and GIT_OPTIONS_<CMD>_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
next prev parent reply other threads:[~2011-05-12 14:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-11 22:57 [PATCH] Adds 'stash.index' configuration option David Pisoni
2011-05-11 23:46 ` Junio C Hamano
2011-05-12 0:26 ` Junio C Hamano
2011-05-12 0:48 ` David Pisoni
2011-05-12 0:54 ` Junio C Hamano
2011-05-12 7:14 ` Michael J Gruber
2011-05-12 8:04 ` Jeff King
2011-05-12 8:14 ` Michael J Gruber
2011-05-12 8:22 ` Jeff King
2011-05-12 14:35 ` Michael J Gruber [this message]
2011-05-12 22:36 ` RFC proposal: set git defaults options from config David Pisoni
2011-05-16 11:05 ` Jeff King
2011-05-16 11:02 ` Jeff King
2011-05-16 12:54 ` Michael J Gruber
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=4DCBF01F.9040009@warpmail.net \
--to=drmicha@warpmail.net \
--cc=dpisoni@gmail.com \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).