git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] t/perf/run: Use proper "--get-regexp", not "--get-regex"

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 4, 2018, 13:33 UTC
Message-ID
<xmqq1sdm65hu.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<alpine.LFD.2.21.1806040659590.11594@localhost.localdomain>
"Robert P. J. Day" <rpjday@crashcourse.ca> writes:
Show 10 quoted lines
> 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 ;-)

Previous: Robert P. J. Day
Message 6 of 6 in “t/perf/run: Use proper "--get-regexp", not "--get-regex"”
  1. t/perf/run: Use proper "--get-regexp", not "--get-regex"Robert P. J. Day, Jun 3, 2018
  2. Thomas GummererJun 3, 2018
  3. Robert P. J. DayJun 3, 2018
  4. Philip OakleyJun 3, 2018
  5. Robert P. J. DayJun 4, 2018
  6. Junio C HamanoJun 4, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.