]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix log-view-diff-common when point is after last entry
authorTom Tromey <tom@tromey.com>
Tue, 19 Sep 2017 02:02:01 +0000 (20:02 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 19 Sep 2017 02:02:01 +0000 (20:02 -0600)
Bug#28466
* lisp/vc/log-view.el (log-view-diff-common): If point is after last
entry, look at the previous revision.

lisp/vc/log-view.el

index 52f56ed990f53403da5474331a55881a84753cf7..d6963d0a1b93bc4be1de1a698d936ed475093e97 100644 (file)
@@ -608,10 +608,16 @@ considered file(s)."
     (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