Subject: bug#28466: 26.0.50; diff in vc-outgoing doesn't work properly

From: Tom Tromey <[email-masked]>
Date: Sat, 16 Sep 2017 15:53:57 -0600

Tom> I was expecting to see a diff showing the combined contents of all 3 of
Tom> my outgoing patches.

Tom> However, the generated diff is missing the oldest patch in the series.

The appended patch fixes this for me.
I'll put it on the Emacs 26 branch after a few days, unless there are
comments.

Tom

diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index 52f56ed..d6963d0 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -608,10 +608,16 @@ log-view-diff-changeset
     (log-view-diff-common beg end t)))
 
 (defun log-view-diff-common (beg end &optional whole-changeset)
-  (let ((to (log-view-current-tag beg))
-        (fr (log-view-current-tag end)))
-    (when (string-equal fr to)
-      ;; TO and FR are the same, look at the previous revision.
+  (let* ((to (log-view-current-tag beg))
+         (fr-entry (log-view-current-entry end))
+         (fr (cadr fr-entry)))
+    ;; 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))))
       (setq fr (vc-call-backend log-view-vc-backend 'previous-revision nil fr)))
     (vc-diff-internal
      t (list log-view-vc-backend