From: Junio C Hamano <gitster@pobox.com>
To: "Robert P. J. Day" <rpjday@crashcourse.ca>
Cc: Philip Oakley <philipoakley@iee.org>,
Thomas Gummerer <t.gummerer@gmail.com>,
Git Mailing list <git@vger.kernel.org>
Subject: Re: [PATCH v2] t/perf/run: Use proper "--get-regexp", not "--get-regex"
Date: Mon, 04 Jun 2018 22:33:33 +0900 [thread overview]
Message-ID: <xmqq1sdm65hu.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <alpine.LFD.2.21.1806040659590.11594@localhost.localdomain> (Robert P. J. Day's message of "Mon, 4 Jun 2018 07:03:25 -0400 (EDT)")
"Robert P. J. Day" <rpjday@crashcourse.ca> writes:
> one thing i don't see there, and it's based on an observation someone
> once made (i believe on this list), is that even if there is
> absolutely no ambiguity in a command, even if there are no pathspec
> arguments, it's still worthwhile to add a trailing "--":
>
> $ git command options/treeish ... --
>
> since that guarantees that git will waste no time trying to identify
> any ambiguity since you're being so precise. is that worth mentioning
> in that page?
I do not think it is worth mentioning _anywhere_ if you sell its
benefit as "even there is no ambiguity it won't spend cycles".
The point of "git cmd X --" and "git cmd -- X" is that they save
your human cycle, not machine cycle; you do not have to waste time
wondering if you happen to have X as path in the working tree. That
may be worth mentioning, but only "maybe" I would think.
A more important reason is you may not _know_ beforehand if X you
mean to be a rev also happens to be a path (or vice versa) when you
are scripting. Writing 'git checkout master', 'git diff HEAD',
etc., in a script you intend to be generic enough is risky if
'master', HEAD, etc. can be both rev and path at the same time, but
that is already described in gitcli page ;-)
prev parent reply other threads:[~2018-06-04 13:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-03 10:14 [PATCH v2] t/perf/run: Use proper "--get-regexp", not "--get-regex" Robert P. J. Day
2018-06-03 13:30 ` Thomas Gummerer
2018-06-03 13:36 ` Robert P. J. Day
2018-06-03 15:33 ` Philip Oakley
2018-06-04 11:03 ` Robert P. J. Day
2018-06-04 13:33 ` Junio C Hamano [this message]
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=xmqq1sdm65hu.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=philipoakley@iee.org \
--cc=rpjday@crashcourse.ca \
--cc=t.gummerer@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).