GNU bug report logs -
#8756
23.3; vc-git.el doesn't use --follow argument in vc-git-print-log
Previous Next
Reported by: Steinar Bang <sb <at> dod.no>
Date: Sun, 29 May 2011 20:28:01 UTC
Severity: normal
Tags: fixed
Merged with 19045
Found in versions 23.3, 25.0.50
Fixed in version 26.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 8756 <at> debbugs.gnu.org (full text, mbox):
>>>>> Dan Nicolaescu <dann <at> gnu.org>:
> I tried doing that at some point, but the result is not completely
> functional, these commands do not work:
> "d" (log-view-diff)
> "f" (log-view-find-revision)
> "a" (log-view-annotate-revision)
Yes, I discovered the same thing.
> which means that the corresponding vc-git.el functions need updating.
> If someone figures out what git commands/sequence of commands are
> needed to implement these, then it should not be too hard to implement
> the needed changes.
I decided to take a look at it again today. The first problem I ran
into, was that the emacs 23.1 version of `vc-git-print-log' used
"git rev-list" instead of "git log". And only "git log" supports
"--follow" to track renames (at least that's what I concluded after
googling for this today. *Please* correct me, if I'm wrong!).
The difference between "git rev-list --pretty HEAD" and "git log" is
that the rev-list has an extra blank line at the end.
So I did an experiment letting `vc-git-print-log' use "git log" if there
is only one file:
#begin_example
--- a/apps/share/emacs23/site-lisp/vc-git.el
+++ b/apps/share/emacs23/site-lisp/vc-git.el
@@ -459,8 +459,12 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
(let ((inhibit-read-only t))
(with-current-buffer
buffer
- (vc-git-command buffer 'async files
- "rev-list" "--pretty" "HEAD" "--")))))
+ (if (= 1 (length flist))
+ ;; If there's only one item, track renames using "git log --follow"
+ (vc-git-command buffer 'async files
+ "log" "--follow" "--")
+ (vc-git-command buffer 'async files
+ "rev-list" "--pretty" "HEAD" "--"))))))
(defvar log-view-message-re)
(defvar log-view-file-re)
#end_example
This had slightly more success than the first attempt:
- `C-x v l' reports the full history (as in the previous attempt)
- Now `d', `f', and `a' works for commits newer than the rename
- After the rename
- `d' no longer fails with "No next version", but reports no diff,
where there should have been a diff
#begin_example
No changes between a92a3d062dac1b0ec5eece4ed6f9570e59f1a69b and 8d304db76993a0da0894b3d30794a2c5ec4927fe
#end_example
- `f' and `a' fails because the file doesn't exist
#begin_example
fatal: no such path apps/share/emacs23/site-lisp/vc-git.el in 8d304db76993a0da0894b3d30794a2c5ec4927fe
#end_example
On a side note: I'm testing for the length of flist, since I know that
it's a list. But flist isn't used after its initial binding in the let
clause, as far as I can see...?
This bug report was last modified 5 years and 252 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.