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

From: Juri Linkov <[email-masked]>
Date: Wed, 08 May 2019 22:52:34 +0300

>> bug#28466 caused a regression in 26.0.50.  Maybe it's too late to fix it
>> in the release branch, so the patch below is for master.
>
> If you want me to consider installing a change in emacs-26,

I'm not sure about a new change for emacs-26, I thought rather about
reverting the previous change in emacs-26, because it is still nor clear
what the right change should be, as the comment from Dmitry indicates.
So a safer option would be just revert the previous change in emacs-26.

> please show a reproducible recipe, because I don't think I understand
> the situation where the problematic behavior happens.

Here is an illustration of the problem:

1. the case when region's beginning (b) and region's end (e)
   is on the same revision in the log-view buffer:

  * h8..: 2019-05-08 Revision h8.
be* g7..: 2019-05-07 Revision g7.
  * f6..: 2019-05-06 Revision f6.
  * e5..: 2019-05-05 Revision e5.

compares the revision f6 (the previous revision of g7) and g7.
This behavior was unchanged by the bug#28466.

2. This case demonstrates the behavior
   BEFORE the change in bug#28466:

  * h8..: 2019-05-08 Revision h8.
b * g7..: 2019-05-07 Revision g7.
e * f6..: 2019-05-06 Revision f6.
  * e5..: 2019-05-05 Revision e5.

compared the revision f6 (from region's end) and g7 (from region's beginning).
This was the correct behavior.

3. Now this case demonstrates the incorrect behavior
   AFTER the change in bug#28466:

  * h8..: 2019-05-08 Revision h8.
b * g7..: 2019-05-07 Revision g7.
e * f6..: 2019-05-06 Revision f6.
  * e5..: 2019-05-05 Revision e5.

compares the revision e5 (the previous revision of the revision at region's end)
and g7 (from region's beginning).

4. This demonstrates the case that the change in bug#28466
   was intended to fix:

  * h8..: 2019-05-08 Revision h8.
b * g7..: 2019-05-07 Revision g7.
  * f6..: 2019-05-06 Revision f6.
  * e5..: 2019-05-05 Revision e5.
e

When region's end is after the last visible revision,
it should compare g7 (from region's beginning)
with the previous revision of the last revision e5
(a hypothetical revision d4, not visible in the buffer).

Before the fix, it compared e5 and g7, that was wrong.
But the fix broke the case when region's end is in the middle
of the buffer.