Re: [feature request] git: tags instead of commit IDs in blame output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 21 August 2010, Jean Delvare wrote:
> Hi there,
> 
> I have a feature request for git. In the output of "git blame", I would
> like to be able to see tags instead of commit IDs in front of each
> line. Basically, I would like to know the first tag which was added
> after the last change of every line. Icing on the cake would be the
> possibility to filter out some tags (for example to ignore release
> candidate tags) but I could easily live without that.
> 
> Does it make sense?
> Would it be difficult to implement?

To me, it seems what you want to do is convert the commit ID in front of 
every blame-line into the result of running 'git name-rev' (or 'git 
describe') on that line.

To that effect something like this should work:

  git blame <file> |
  while read sha1 rest
  do
      tag=$(git name-rev --tags --name-only $sha1) &&
      echo "$tag $rest"
  done

Of course, if you're doing this at a bigger scale, you want to wrap this in 
a script that (1) caches commitID -> tag mappings, and that (2) runs 'git 
name-rev in its --stdin mode'.


Have fun! :)

...Johan

-- 
Johan Herland, <johan@xxxxxxxxxxx>
www.herland.net
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]