From 62d96473867dfa71a9719dd41710cd2a155d9055 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 16 Dec 2023 01:48:29 +0200 Subject: [PATCH] (vc-print-log-setup-buttons): Start "previous" history with specified revision * lisp/vc/vc-git.el (vc-git-file-name-changes-switches): Remove the comment above the option. Seems unnecessary now. * lisp/vc/vc.el (vc-print-log-setup-buttons): Start the "previous" change history buffer with the specified revision, rather than have the sentinel jump to it. Apparently in some cases the history of the old name can't be found. In others, the log just shows faster. But note the caveat described in the second new comment (bug#55871). --- lisp/vc/vc-git.el | 2 -- lisp/vc/vc.el | 11 ++++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index fa1f14b65bb..f6e8e1b7042 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -153,8 +153,6 @@ comparing changes. See Man page `git-blame' for more." (repeat :tag "Argument List" :value ("") string)) :version "30.1") -;; XXX: (setq vc-git-log-switches '("--simplify-merges")) can also -;; create fuller history when using this feature. Not sure why. (defcustom vc-git-file-name-changes-switches '("-M" "-C") "String or list of string to pass to Git when finding previous names. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 1234424a8d9..0f74449c92d 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2709,6 +2709,8 @@ LIMIT is nil, or if PL-RETURN is `limit-unsupported'." (if (< entries limit) ;; The log has been printed in full. Perhaps it started ;; with a copy or rename? + ;; FIXME: We'd probably still want this button even when + ;; vc-log-show-limit is customized to 0 (should be rare). (let* ((last-revision (log-view-current-tag (point-max))) ;; XXX: Could skip this when vc-git-print-log-follow = t. (name-changes @@ -2743,7 +2745,14 @@ LIMIT is nil, or if PL-RETURN is `limit-unsupported'." (with-current-buffer vc-parent-buffer ;; To set up parent buffer in the new viewer. (vc-print-log-internal backend old-names - last-revision nil limit)))) + last-revision t limit)))) + ;; XXX: Showing the full history for OLD-NAMES (with + ;; IS-START-REVISION=nil) can be better sometimes + ;; (e.g. when some edits still occurred after a rename + ;; -- multiple branches scenario), but it also can hurt + ;; in others because of Git's automatic history + ;; simplification: as a result, the logs for some + ;; use-package's files before merge could not be found. 'help-echo "Show the log for the file name(s) before the rename"))) ;; Perhaps there are more entries in the log. -- 2.39.2