Re: finding earliest tags descended from a given commit

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Friday, January 26, 2007 - 9:34 pm

On Fri, 26 Jan 2007, J. Bruce Fields wrote:

You can name any revision based on the set of tags you have with:

	git name-rev --tags <sha1-of-commit>

which will try to find the "simplest" way to name something by following 
one of your tags.

If no tag can be found that reaches that commit, it will say

	<sha1> undefined

but otherwise you will get something like this:

	[torvalds@woody linux]$ git name-rev --tags 7658cc28
	7658cc28 tags/v2.6.20-rc3^0~58

(That's the "VM: Fix nasty and subtle race in shared mmap'ed page 
writeback commit").

So that basically tells you that it's the 58'th parent of v2.6.20-rc3, ie 
it was in -rc3, but not in -rc2.


Yeah. That mostly works too, and kind of for the right reason: it's a 
related operation. But as you can tell, git-describe tells you which 
version somethign is *based* on, not when it was merged, so while it gives 
you a starting point for your search, it's not what you want.

Basically 'git descibe' goes the "other way": it walks backwards from the 
commit to the nearest tag that can be found, while 'git name-rev --tags' 
walks the history backwards from the tags, and tries to find the commit. 

NOTE! 'git name-rev' can in theory be quite expensive, although if you 
have a packed repository you'll probably never even notice it.

		Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
finding earliest tags descended from a given commit, J. Bruce Fields, (Fri Jan 26, 9:06 pm)
Re: finding earliest tags descended from a given commit, Shawn O. Pearce, (Fri Jan 26, 9:22 pm)
Re: finding earliest tags descended from a given commit, Linus Torvalds, (Fri Jan 26, 9:34 pm)
Re: finding earliest tags descended from a given commit, J. Bruce Fields, (Fri Jan 26, 9:42 pm)
Re: finding earliest tags descended from a given commit, Shawn O. Pearce, (Fri Jan 26, 9:55 pm)
Re: finding earliest tags descended from a given commit, Junio C Hamano, (Fri Jan 26, 10:23 pm)
[PATCH] name-rev: introduce the --ref-filter=&lt;regex&gt; option, Johannes Schindelin, (Sat Jan 27, 5:39 am)
[PATCH] name-rev: introduce the --ref-filter=&lt;pattern&gt; option, Johannes Schindelin, (Sat Feb 17, 11:22 am)
[PATCH] git-name-rev: accept list of refs from user, Jeff King, (Sat Feb 17, 4:13 pm)
Re: [PATCH] git-name-rev: accept list of refs from user, Junio C Hamano, (Sat Feb 17, 4:30 pm)
Re: [PATCH] git-name-rev: accept list of refs from user, Johannes Schindelin, (Sat Feb 17, 5:02 pm)