1

I often find myself in the following situation:

  1. Look at some code in a project (e.g. string-trim in subr-x.el in Emacs)
  2. magit-blame to see which commit added that code
  3. Wonder which tags of the project comes after that commit
    • Immediate use case is to find a version of Emacs that contains string-trim, so as to specify the dependency in a package header

It's not clear how best to achieve step 3. I can get the commit hash from step 2--then what?

  • 2
    One way to automate it would be to (1) find all tags, (2) git tag --contains b55aea382c32f4448892265f322a38290ce10305 (that's the commit that added string-trim as per your example). You'll get a list of tags. Since Emacs seems to be very consistent in tag names, you can just sort them and choose the earliest one. – wvxvw May 10 '17 at 8:14
1

If you visit the revision buffer (hit enter from the blame buffer), you should see a line that looks like this:

Parent:     41ce6f7027 * lisp/subr.el (string-suffix-p): New function.
Containing: emacs-24 emacs-25 [...] (5 more)
Follows:    mh-e-8.5 (3693)
Precedes:   emacs-24.5-rc3-fixed (2877)

The "Follows:" line is generated with git describe --tags <revision>, and the "Precedes:" line is generated with git describe --contains <revision>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.