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

Re: Getting first tag per branch for a commit

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 25, 2017, 22:22 UTC
Message-ID
<xmqqd19r7lml.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqy3sf7mxo.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 14 quoted lines
> Orgad Shaneh <orgads@gmail.com> writes:
>
>> What I'd like to have is a way to tell the first tag per branch (or
>> per merge) that the commit appeared on.
>
>> I think that this can be done by filtering out tags that are connected
>> to already listed tags by first-parent link.
>
> Yes.  When one tag can be reached by another tag, then the former is
> definitely an earlier tag than the latter.
>
> A trivial way to compute it would require O(n^2) invocations of "git
> merge-base --is-ancestor".  Alternatively, I think you can perhaps
> use "git merge-base --independent".

Ah, forget the latter. "independent" is about solving the opposite use case--it is to cull the ones that can be reached by other tips.

Previous: Junio C HamanoNext: Orgad Shaneh
Message 3 of 4 in “Getting first tag per branch for a commit”
  1. Orgad ShanehJun 25, 2017
  2. Junio C HamanoJun 25, 2017
  3. Junio C HamanoJun 25, 2017
  4. Orgad ShanehJun 26, 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.