From: Johan Herland <johan@herland.net>
To: git@vger.kernel.org
Cc: Jean Delvare <khali@linux-fr.org>
Subject: Re: [feature request] git: tags instead of commit IDs in blame output
Date: Sat, 21 Aug 2010 12:10:22 +0200 [thread overview]
Message-ID: <201008211210.23280.johan@herland.net> (raw)
In-Reply-To: <20100821095352.604a2b85@hyperion.delvare>
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@herland.net>
www.herland.net
next prev parent reply other threads:[~2010-08-21 10:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-21 7:53 [feature request] git: tags instead of commit IDs in blame output Jean Delvare
2010-08-21 10:10 ` Johan Herland [this message]
2010-08-24 12:54 ` Jean Delvare
2010-08-24 14:53 ` Johan Herland
2010-08-25 7:32 ` Jean Delvare
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=201008211210.23280.johan@herland.net \
--to=johan@herland.net \
--cc=git@vger.kernel.org \
--cc=khali@linux-fr.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).