Re: Gitk feature - show nearby tags
- From
Paul Mackerras <paulus@samba.org>
- Date
- Jun 4, 2006, 01:59 UTC
- Message-ID
- <17538.16015.53244.876090@cargo.ozlabs.ibm.com>
- In-Reply-To
- <e5bfff550606030416s2ef6182crbde1395dd29e5b94@mail.gmail.com>
Marco Costalba writes:
> If I have understood correctly the patch runs a 'git rev-list --all > --topo-order --parents' > and then does a tree walking.
Yes, that's right. It means that gitk can show the nearest tags even if they aren't included in the current view.
> I am wandering if there exist any native git way to found the previous tag.
I don't know of any. Doing the tree walking in Tcl turned out to be not too much of an overhead, though; it does the whole kernel repository in 1.5 seconds on my G5.
Show 16 quoted lines
> 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 > > I've missed something?
I'm not sure exactly what that would do, but gitk can show more than one tag (the term "nearest tag" is only a shorthand approximation for what it does). For example, if you have two tagged commits where neither is an ancestor of the other, and do a merge of the two, gitk will show both tags when you select the merge. It doesn't actually happen in the kernel repository, though, because the tags there form a linear list (at least the tags in the upstream repository do).
Paul.