GNU bug report logs - #39044
27.0.50; On git log-view-diff does not work for moved files.

Previous Next

Package: emacs;

Reported by: David Koppelman <koppel <at> ece.lsu.edu>

Date: Wed, 8 Jan 2020 21:00:02 UTC

Severity: normal

Found in version 27.0.50

Fixed in version 30.1

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: David Koppelman <koppel <at> ece.lsu.edu>, 39044 <at> debbugs.gnu.org
Subject: bug#39044: 27.0.50; On git log-view-diff does not work for moved files.
Date: Wed, 13 May 2020 04:36:37 +0300
On 08.01.2020 22:48, David Koppelman wrote:
> 
> With (setq vc-git-print-log-follow t) visit a file in a git repo that
> was moved from some other directory and which had changes when in that
> other directory. Start log view, C-x v =, move the cursor to a commit
> made in the file's former location, and press d (log-view-diff). Rather
> than showing a diff, a message reporting no changes is shown.

I usually give up and press 'D' in those cases (diff for the whole tree).

> This flaw was noted in bug 8756, covering vc-diff/log-view, but was
> left to a follow on bug.
> (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=8756).
> 
> Interestingly, vc-annotate has no trouble with renames. See
> commit d1e4c4037e88f3256db19813805d03f8ad0291fa.

vc-annotate is fine because 'git blame' includes the previous file name 
in the output. Not so for 'git log' by default.

Looking at this issue for some time, I haven't found an easier way to do 
this rather than:

1. When vc-git-print-log-follow=t, also add the --name-status argument 
to the command invocation.

2. Hide this new text from the user using font lock by adding some rules 
to vc-git-log-view-mode.

3. _Probably_ teach log-view-current-file how to determine the current 
file name. _Maybe_ via log-view-file-re. Some come would also need to 
set log-view-per-file-logs to t for per-file Git logs. It could also be 
made into a backend method instead.

See also bug#13004 for the same problem when using Hg. It could use the 
same approach, but the solution is more questionable since '--stat' 
seems to noticeably slow it down.




This bug report was last modified 1 year and 154 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.