From: Dmitry Gutov Date: Thu, 23 Sep 2021 11:53:31 +0000 (+0300) Subject: Fix vc-annotate-show-log-revision-at-line X-Git-Tag: emacs-28.0.90~722 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=46a2c191f2cdda4144dfe7bfce064588f2b2f780;p=emacs.git Fix vc-annotate-show-log-revision-at-line * lisp/vc/vc-annotate.el (vc-annotate-show-log-revision-at-line): Stop from being affected by 'vc-git-print-log-follow'. * lisp/vc/vc-git.el (vc-git-print-log-follow): Mention caveats in a comment. --- diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el index 82531f742e4..45bb17749bc 100644 --- a/lisp/vc/vc-annotate.el +++ b/lisp/vc/vc-annotate.el @@ -545,6 +545,7 @@ Return a cons (REV . FILENAME)." (defvar log-view-vc-backend) (defvar log-view-vc-fileset) +(defvar vc-git-print-log-follow) (defun vc-annotate-show-log-revision-at-line () "Visit the log of the revision at line. @@ -559,6 +560,8 @@ the file in question, search for the log entry required and move point." (message "Cannot extract revision number from the current line") (let ((backend vc-annotate-backend) (log-buf (get-buffer "*vc-change-log*")) + ;; No need to follow renames: we specify the historical file name. + vc-git-print-log-follow pos) (if (and log-buf diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 8332600c690..eca8d547a90 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1147,6 +1147,14 @@ This prompts for a branch to merge from." (autoload 'vc-setup-buffer "vc-dispatcher") +;; It's a weird option due to how Git handles '--follow', and it can +;; hide certain (usually merge) commits in the `vc-print-log' buffers. +;; +;; (setq vc-git-log-switches '("-m")) can fix that, but at the cost of +;; duplicating many merge commits in the log. +;; +;; Long explanation here: +;; https://stackoverflow.com/questions/46487476/git-log-follow-graph-skips-commits (defcustom vc-git-print-log-follow nil "If true, follow renames in Git logs for a single file." :type 'boolean