From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: Marius Paliga <marius.paliga@gmail.com>,
Christian Couder <christian.couder@gmail.com>,
"git\@vger.kernel.org" <git@vger.kernel.org>,
Jeff King <peff@peff.net>,
thais.dinizbraz@gmail.com
Subject: Re: [PATCH] builtin/push.c: add push.pushOption config
Date: Sat, 21 Oct 2017 10:52:33 +0900 [thread overview]
Message-ID: <xmqqfuadgtcu.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CAGZ79kbEmdJu9a-h07UvPaymMmLJ4Azm+iChSpCBwvvtOW8gog@mail.gmail.com> (Stefan Beller's message of "Fri, 20 Oct 2017 12:02:09 -0700")
Stefan Beller <sbeller@google.com> writes:
>>> So in the config, we have to explicitly give an empty option to
>>> clear the previous options, but on the command line we do not need
>>> that, but instead we'd have to repeat any push options that we desire
>>> that were configured?
>>
>> It is not wrong per-se to phrase it like so, but I think that is
>> making it unnecessarily confusing by conflating two things. (1)
>> configured values are overridden from the command line, just like
>> any other --option/config.variable pair
>
> because they are single value options (usually).
>
>> and (2) unlike usual single
>> value variables where "last one wins" rule is simple enough to
>> explain,, multi-value variables need a way to "forget everything we
>> said so far and start from scratch" syntax, especially when multiple
>> input files are involved.
>
> ok, my view of how that should be done is clashing once again
> with the projects established standards. Sorry for the noise.
I do not think it is a noise. I was primarily focusing on "have to
explicitly" part, making it sound as if it was a flaw. I do think
it is a good idea to explain a variable and/or an option is
multi-valued and how multiple instances of them interact with each
other. I think the status quo is:
Both configuration and command line, these multi-valued
things accumulate. The "command line can be used to
override things from the configuration" rule applies as any
other config/option pair.
In addition, in the configuration, there is a mechanism to
clear the values read so far with the "an empty value
clears" rule, because you may not have control over, or it
may be cumbersome to modify, lower-priority configuration
files. There is no such thing for command line, as the
entirety of the command line for each invocation is under
your control.
If somebody has
[alias] mypush = push -ofoo
then the command line argument for one invocation of "git mypush"
may *not* be under your control and it might be also convenient if
there were a mechanism to clear what has been accumulated from the
command line. It may be worth considering, but if we were going in
that direction, I suspect that it is probably a good idea to first
step back a bit and introduce a mechanism to easily define pairs of
option/config in a more sysmtematic way [*1*]. Once we have such a
mechanism, the "clear the previous" syntax for the command line
would be implemented uniformly in there.
[Footnote]
*1* E.g. right now, the fact that "push --push-option" and
"push.pushOption" are related, or that "status -u<mode>" and
"status.showUntrackedFiles" are related, is only known to the
code and the documentation; I am not sure if it is even a good
idea to add config to each and every option that exists, but for
the ones that do exist, it would be nicer if there were a more
uniform and systematic way for parse-options.c and config.c APIs
to help our code, instead of writing git_config() callback and
options[] array to give to parse_options(), making sure they
refer to the same internal variable, and the latter overrides
the former.
next prev parent reply other threads:[~2017-10-21 1:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 6:32 [PATCH] Added support for new configuration parameter push.pushOption Marius Paliga
2017-10-18 0:54 ` Junio C Hamano
2017-10-18 1:04 ` Junio C Hamano
2017-10-19 17:47 ` [PATCH] builtin/push.c: add push.pushOption config Marius Paliga
2017-10-19 19:46 ` Stefan Beller
2017-10-20 2:19 ` Junio C Hamano
2017-10-20 6:17 ` Junio C Hamano
2017-10-20 6:18 ` Junio C Hamano
2017-10-20 8:52 ` Marius Paliga
2017-10-21 1:33 ` Junio C Hamano
2017-10-20 19:02 ` Stefan Beller
2017-10-21 1:52 ` Junio C Hamano [this message]
2017-10-23 11:44 ` Marius Paliga
2017-10-24 0:59 ` Junio C Hamano
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=xmqqfuadgtcu.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=marius.paliga@gmail.com \
--cc=peff@peff.net \
--cc=sbeller@google.com \
--cc=thais.dinizbraz@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.