From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: James <rouzier@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] clean: new option --exclude-from
Date: Wed, 2 Dec 2015 12:51:45 -0500 [thread overview]
Message-ID: <20151202175144.GA18550@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqd1uo69vf.fsf@gitster.mtv.corp.google.com>
On Wed, Dec 02, 2015 at 09:25:24AM -0800, Junio C Hamano wrote:
> I do not think we should liberally add options that apply to
> anything "git" in the first place [*1*]. Limit them to ones that
> are really special and fundamental that changes the way Git
> operates, i.e. "Where is our $GIT_DIR?" is a good thing for users to
> be able to tell "git" itself. Compared to that, the ignore patterns
> is a fringe that is used only by commands that care about the
> working tree (e.g. the global option in "git --exclude='*.o'
> ls-tree" would be meaningless).
>
>
> [Footnote]
>
> *1* It would add unnecessary confusion to the end users; they have
> to decide if they need to pass an option before or after the
> subcommand name. If the motivation behind the "git --option cmd"
> is to share code and semantics for common "--option", we should
> instead further refactor command line option handling, just like
> the code for config handling allows us to share config_default.
My motivation isn't exactly code sharing. It is that you sometimes want
to affect sub-commands of a program, and cannot pass command line
options to them yourself.
For instance, "git-stash --include-untracked" will call "git clean"
under the hood. There is no way to say "...and treat foo.* as ignored
for this invocation". It could grow its own "-e" option, but that does
not help any other third-party scripts which call "git clean".
So IMHO this is not really about command-line options, but about the
environment in which a command is executed. Environment variables are
the obvious way to do that; "git --foo" options are just syntactic sugar
to set the variables. We could just add variables without matching
options.
I agree that we could end up proliferating such options (or environment
variables). Using the logic above, you could argue that I should be able
to affect any option of any sub-command in a script, which just gets
silly. My rule of thumb would be that if there is some implicit state in
the on-disk repo (e.g., what is in your .git/config) that you
might want to override for a one-shot invocation, then it may be a
reasonable candidate. The "git -c" config override is such an example.
In this case, it is basically adding to ".git/info/exclude", which
follows the same rule.
But like I said, I do not feel all that strongly about this particular
option. I would not use it myself. Just trying to make my reasoning
clear. :)
-Peff
next prev parent reply other threads:[~2015-12-02 17:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-26 14:44 [PATCH] clean: new option --exclude-from James
2015-11-30 2:24 ` Eric Sunshine
[not found] ` <CAGjXF72PgdjBw03ERVYxj+atvsBXK0LeJ6O3zTZgi3-kv9BWsw@mail.gmail.com>
2015-12-01 22:25 ` Eric Sunshine
2015-12-06 14:58 ` [PATCH v2 1/2] modernize t7300 James
2015-12-06 14:58 ` [PATCH v2 2/2] clean: new option --exclude-from James
2015-12-07 20:56 ` Jeff King
2015-12-07 21:44 ` Junio C Hamano
2015-12-07 22:53 ` Eric Sunshine
2015-12-07 21:40 ` [PATCH v2 1/2] modernize t7300 Junio C Hamano
2015-12-07 22:46 ` Eric Sunshine
2015-12-07 22:50 ` Junio C Hamano
2015-12-07 22:43 ` Eric Sunshine
2015-12-02 0:53 ` [PATCH] clean: new option --exclude-from Jeff King
2015-12-02 2:18 ` Junio C Hamano
2015-12-02 2:44 ` Jeff King
2015-12-02 16:40 ` Junio C Hamano
2015-12-02 16:47 ` Jeff King
2015-12-02 17:25 ` Junio C Hamano
2015-12-02 17:51 ` Jeff King [this message]
2015-12-06 3:51 ` Junio C Hamano
2015-12-07 19:39 ` Jeff King
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=20151202175144.GA18550@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rouzier@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 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).