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

Re: [PATCH] Documentation: fix misnested -l and --contains in git-tag synopsis

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 5, 2010, 16:51 UTC
Message-ID
<7vzktnu311.fsf@alter.siamese.dyndns.org>
In-Reply-To
<AANLkTikXM4BjRHOeS=3mirr9=YRW8sdaHFt05D-9BDxL@mail.gmail.com>
Philip Jägenstedt <philip@foolip.org> writes:
> ... they do in fact interact in some non-obvious way or if -l <pattern>
> --contains <commit> means something different from -l --contains
> <commit> <pattern>, it would be great if that were made more clear.

There is no difference; at least there shouldn't be any, and if there are, you found a bug in the implementation.

Let's try to see if I can explain it better.
"git tag" command operates in four modes:
 - "Creating" is the default mode.
 - "Verifying" is triggered with the -v option.
 - "Deleting" is triggered with the -d option.
 - "Listing" is triggered with the -l option.

In "Listing" mode, you can limit which ones are shown by adding <pattern> at the end [*1*]; "--contains <commit>" can also be used to limit. You can change how tags are shown by "-n <lines>" option.

Absense of -v, -d, or -l options does not automatically mean "Creating" mode; when it is clear from other options that "Listing" is requested, we do so without "-l". When you have "--contains <commit>", for example, it is obvious that you want a listing. The same if you have "-n1".

[Footnote]

*1* I think allowing <pattern> anywhere on the command line but at the end is actually a bug.

Even though it can be argued that it does not _hurt_ not to refuse such a command line (i.e. the command would do something useful), it appears to me that it did hurt in this particular case by giving a false impression that somehow "-l" takes an optional <pattern> argument by allowing other options after "-l <pattern>" is given.

Arguably, it is the same kind of "usability measure" as our dwimming into listing mode without "-l" when we can infer the intent of the user from other options, but I think we sometimes overdo usability measures to the point that they negatively affect the learning curve of users.

I also think allowing only one <pattern> is a bug. The command should filter the tags by union of <pattern>s, just like how pathspec works.

Previous: Philip Jägenstedt
Message 4 of 4 in “Documentation: fix misnested -l and --contains in git-tag synopsis”
  1. Documentation: fix misnested -l and --contains in git-tag synopsisPhilip Jägenstedt, Nov 3, 2010
  2. Junio C HamanoNov 4, 2010
  3. Philip JägenstedtNov 5, 2010
  4. Junio C HamanoNov 5, 2010

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.