Re: Gitk feature - show nearby tags
- From
- Marco Costalba <mcostalba@gmail.com>
- Date
- Jun 4, 2006, 09:54 UTC
- Message-ID
- <e5bfff550606040254n1449b62ta70c209ad8e1a0c@mail.gmail.com>
- In-Reply-To
- <7vodx9cm3g.fsf@assigned-by-dhcp.cox.net>
On 6/4/06, Junio C Hamano <junkio@cox.net> wrote:
Show 29 quoted lines
> "Marco Costalba" <mcostalba@gmail.com> writes: > > > As example given a selected revision with id <sha> is it possible to > > do something like this to fond the ancestor? > > > > 1) get the tag list with git-peek-remote or something similar if tags > > are not already loaded > > > > 2) given the tagList vector with n elements run > > > > git-rev-list --topo-order <sha> ^tagList[0] ^tagList[1] .... > > ^tagList[n-1] > > > > 3) take the last sha spit out by git-rev-list, be it <lastSha>. > > > > 4) Previous nearest tag is the parent of lastSha > > Sorry, I do not understand what you are doing here at all. > Suppose you have this simple history. > > (root) > > a---b---d---e---f---g > t1 \ / t3 > ---c > t2 > > and <sha1> in (2) is "e". When tagList = (t1, t2, t3), the > above rev-list would return empty.
This is enough!
Empty list is an useful and enough information.
It means:
1) Parent of current revision ("e" in our case) is a tag, indeed our seeked tag.
2) If previous point is not true then there are no previous tags.In a less corner case, just to better explaing my idea, consider this:
a---b---d---e---f---g---h
t1 \ / t3
---c
t2Where our sha1 is still "e", in this case
git-rev-list --topo-order <e> ^a ^c ^g
gives, as last revision in output list, "f" Then parentOf(<f>) is <g> and our looked for tag is t3
Marco