git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: git@vger.kernel.org
Subject: Re: finding earliest tags descended from a given commit
Date: Fri, 26 Jan 2007 20:34:15 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0701262022230.25027@woody.linux-foundation.org> (raw)
In-Reply-To: <20070127040618.GA14205@fieldses.org>



On Fri, 26 Jan 2007, J. Bruce Fields wrote:
>
> Just curious: every now and then somebody will ask me what kernel
> version they need to upgrade to to get some given fix.  I can find the
> commit with the given fix easily enough.  How do I then find the
> earliest tagged version containing that fix?

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.

> I usually just do
> 
> 	git-describe <commit>
> 
> to make a guess, then
> 
> 	git log <tag>..<commit>

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

  parent reply	other threads:[~2007-01-27  4:34 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-27  4:06 finding earliest tags descended from a given commit J. Bruce Fields
2007-01-27  4:22 ` Shawn O. Pearce
2007-01-27  4:34 ` Linus Torvalds [this message]
2007-01-27  4:42   ` J. Bruce Fields
2007-01-27  4:55     ` Shawn O. Pearce
2007-01-27  5:23       ` Junio C Hamano
2007-01-27 12:39         ` [PATCH] name-rev: introduce the --ref-filter=<regex> option Johannes Schindelin
2007-02-17 14:02           ` Johannes Schindelin
2007-02-17 14:59             ` Jeff King
2007-02-17 17:50               ` Johannes Schindelin
2007-02-17 18:25               ` Junio C Hamano
2007-02-17 23:13                 ` [PATCH] git-name-rev: accept list of refs from user Jeff King
2007-02-17 23:19                   ` Jeff King
2007-02-17 23:30                     ` Junio C Hamano
2007-02-17 23:40                       ` Jeff King
2007-02-18  0:02                         ` Johannes Schindelin
2007-02-17 17:42             ` [PATCH] name-rev: introduce the --ref-filter=<regex> option Junio C Hamano
2007-02-17 18:01               ` Johannes Schindelin
2007-02-17 18:22               ` [PATCH] name-rev: introduce the --ref-filter=<pattern> option Johannes Schindelin
2007-02-17 18:47                 ` Junio C Hamano
2007-02-17 23:55                   ` Johannes Schindelin
2007-02-17 19:00                 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0701262022230.25027@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=bfields@fieldses.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).