Subject: bug#35624: log-view-diff regression

From: Juri Linkov <[email-masked]>
Date: Thu, 09 May 2019 22:41:15 +0300

found 35624 26.1
tags 35624 + patch
quit

>> This is exactly what was my initial thought, but this is a wrong fix,
>> as I realized later.
>
> Okay, let's work on it.
>
> I do want to just commit that patch first, since it was obviously the idea
> behind the previous change.

Since it's wrong in any case, better to revert it altogether in emacs-26.

>> I also tried
>>
>>    (not (re-search-forward log-view-message-re nil t))
>>
>> but it seems this is impossible to do because currently
>> log-view.el doesn't support the notion of the end of
>> the last revision expanded body.
>
> The other option is check whether all lines between the point and EOB are
> either empty of start with "Show 2X entries". Which is a design I don't
> particularly like, but it could serve your goal.

Actually there is the much needed function log-view-inside-comment-p
for expanded comments, and this patch correctly handles all cases:

diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index e47fad8908..f7aeacc273 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -618,10 +618,11 @@ log-view-diff-common
     ;; When TO and FR are the same, or when point is on a line after
     ;; the last entry, look at the previous revision.
     (when (or (string-equal fr to)
-              (>= (point)
-                  (save-excursion
-                    (goto-char (car fr-entry))
-                    (forward-line))))
+              (and (not (log-view-inside-comment-p end))
+                   (save-excursion
+                     (goto-char end)
+                     (beginning-of-line)
+                     (not (re-search-forward log-view-message-re nil t)))))
       (setq fr (vc-call-backend log-view-vc-backend 'previous-revision nil fr)))
     (vc-diff-internal
      t (list log-view-vc-backend