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

Re: [PATCH] tag: Implicitly supply --list given another list-like option

From
Jeff King <peff@peff.net>
Date
Mar 12, 2017, 11:19 UTC
Message-ID
<20170312111952.ryhkkrgldub26qky@sigill.intra.peff.net>
In-Reply-To
<20170311120855.16756-1-avarab@gmail.com>
On Sat, Mar 11, 2017 at 12:08:55PM +0000, Ævar Arnfjörð Bjarmason wrote:
Show 17 quoted lines
> Jeff King pointed out in
> <20170310124247.jvrmmcz2pbv4qf3o@sigill.intra.peff.net> in reply to
> that::
> 
>     The difference between "branch" and "tag" here is that "branch
>     --contains" implies "--list" (and the argument becomes a pattern).
>     Whereas "tag --contains" just detects the situation and complains.
> 
>     If anything, I'd think we would consider teaching "tag" to behave
>     more like "branch".
> 
> I agree. This change does that, the only tests that broke as a result
> of this were tests that were explicitly checking that this
> "branch-like" usage wasn't permitted, i.e. no actual breakages
> occurred, and I can't imagine an invocation that would negatively
> impact backwards compatibility, i.e. these invocations all just
> errored out before.

Trying to think of counter-arguments, the best I could come up with is that the situation is potentially ambiguous, and some user could be confused by us doing the wrong thing. I don't find that particularly compelling, especially as the "wrong thing" is to list tags, which is not a destructive operation.

So I think this is an improvement. As for the patch itself:
> +	/* We implicitly supply --list with --contains, --points-at,
> +	   --merged and --no-merged, just like git-branch */
> +	if (filter.with_commit || filter.points_at.nr || filter.merge_commit)
> +		cmdmode = 'l';

I was about to complain that this needs "!cmdmode", but I just looked forward in the thread and saw that Junio already covered that in more detail. I concur.

Thanks for working on this.
-Peff
Previous: Ævar Arnfjörð Bjarmason
Message 11 of 11 in “BUG: "git branch --contains <commit> <name>" does nothing, silently fails”
  1. Ævar Arnfjörð BjarmasonMar 10, 2017
  2. Jeff KingMar 10, 2017
  3. Ævar Arnfjörð BjarmasonMar 10, 2017
  4. tag: Implicitly supply --list given another list-like optionÆvar Arnfjörð Bjarmason, Mar 11, 2017
  5. Ævar Arnfjörð BjarmasonMar 11, 2017
  6. Junio C HamanoMar 12, 2017
  7. Junio C HamanoMar 12, 2017
  8. Ævar Arnfjörð BjarmasonMar 12, 2017
  9. Junio C HamanoMar 12, 2017
  10. Ævar Arnfjörð BjarmasonMar 12, 2017
  11. Jeff KingMar 12, 2017

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.