summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2021-09-23 14:53:31 +0300
committerDmitry Gutov <dgutov@yandex.ru>2021-09-23 14:53:46 +0300
commit46a2c191f2cdda4144dfe7bfce064588f2b2f780 (patch)
treed590aa2b0434f968b95f30f11fa31b70ee8f952e
parenta6a1c8600f2a919948412401b8602450f23bb338 (diff)
downloademacs-46a2c191f2cdda4144dfe7bfce064588f2b2f780.tar.gz
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.
-rw-r--r--lisp/vc/vc-annotate.el3
-rw-r--r--lisp/vc/vc-git.el8
2 files changed, 11 insertions, 0 deletions
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