Re: [RFC PATCH] Implement vc-git-annotate-show-diff-revision-at-line for emacs vc-git
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 22, 2008, 20:51 UTC
- Message-ID
- <7vbq6890km.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <1203706693.7552.56.camel@alexjb-desktop.transitives.com>
Alex Bennee <kernel-hacker@bennee.com> writes:
Show 5 quoted lines
> +(defun vc-git-annotate-extract-revision-at-line () > + (save-excursion > + (move-beginning-of-line 1) > + (and (looking-at "[0-9a-f]+") > + (buffer-substring (match-beginning 0) (match-end 0)))))
Does this grab the commit object name from the annotation of a _full_ file? How is the annotation done? With "blame" without frills?
It may be interesting to run:
git blame -w -n -f -C -- $path
which would give you the code movement (ignoring whitespace changes) across files, so that you can view where the line really originated from.
You can also throw in -L line range limiter like this:
git blame -L$lineno-10,+20 -w -n -f -C -- $path
which would limit the output to lines around the current line, and that would be slightly less expensive than annotating the whole file, if you do this on-demand.
E.g.
$ git blame -L48,+20 -w -n -f -C -- block/blk-exec.c
would give you something like:
165125e1 block/ll_rw_blk.c 2585 (Jens Axboe 2007-07-2...
f1970baf drivers/block/ll_rw_blk.c 2255 (James Bottomley 2005-06-2...
8ffdc655 block/ll_rw_blk.c 2320 (Tejun Heo 2006-01-0...
f1970baf drivers/block/ll_rw_blk.c 2257 (James Bottomley 2005-06-2...
f1970baf drivers/block/ll_rw_blk.c 2258 (James Bottomley 2005-06-2...
f1970baf drivers/block/ll_rw_blk.c 2259 (James Bottomley 2005-06-2...
f1970baf drivers/block/ll_rw_blk.c 2260 (James Bottomley 2005-06-2...
4aff5e23 block/ll_rw_blk.c 2530 (Jens Axboe 2006-08-1...
f1970baf drivers/block/ll_rw_blk.c 2262 (James Bottomley 2005-06-2...
4c5d0bbd block/ll_rw_blk.c 2480 (Andrew Morton 2006-03-2...
4c5d0bbd block/ll_rw_blk.c 2481 (Andrew Morton 2006-03-2...
4c5d0bbd block/ll_rw_blk.c 2482 (Andrew Morton 2006-03-2...
4c5d0bbd block/ll_rw_blk.c 2483 (Andrew Morton 2006-03-2...
4c5d0bbd block/ll_rw_blk.c 2484 (Andrew Morton 2006-03-2...
f1970baf drivers/block/ll_rw_blk.c 2265 (James Bottomley 2005-06-2...
6e39b69e block/ll_rw_blk.c 2309 (Mike Christie 2005-11-1...
6e39b69e block/ll_rw_blk.c 2310 (Mike Christie 2005-11-1...
637b48c8 drivers/block/ll_rw_blk.c 1872 (Jens Axboe 2004-03-1...
637b48c8 drivers/block/ll_rw_blk.c 1873 (Jens Axboe 2004-03-1...
637b48c8 drivers/block/ll_rw_blk.c 1874 (Jens Axboe 2004-03-1...