[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19045: 25.0.50; [PATCH] vc-git-print-log use --follow
From: |
Juri Linkov |
Subject: |
bug#19045: 25.0.50; [PATCH] vc-git-print-log use --follow |
Date: |
Sat, 03 Feb 2018 23:59:58 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) |
Too bad that a new useful customizable variable
vc-git-print-log-follow is not mentioned in NEWS.26.
It works quite well, but only with the following fix
that puts more restrictions - it checks not only
for a directory, but also if it is a single file.
The whole patch is intended for the emacs-26 branch:
diff --git a/etc/NEWS b/etc/NEWS
index 5b3e445..6aa4b2d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1169,6 +1169,9 @@ branch-related commands on a keymap bound to 'B'.
*** 'vc-region-history' is now bound to 'C-x v h', replacing the older
'vc-insert-headers' binding.
+*** New user option 'vc-git-print-log-follow' follow renames in Git logs
+for a single file.
+
** CC mode
---
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 3bf837c..9b54b88 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -994,7 +994,7 @@ This prompts for a branch to merge from."
(autoload 'vc-setup-buffer "vc-dispatcher")
(defcustom vc-git-print-log-follow nil
- "If true, follow renames in Git logs for files."
+ "If true, follow renames in Git logs for a single file."
:type 'boolean
:version "26.1")
@@ -1019,8 +1019,9 @@ If LIMIT is non-nil, show no more than this many entries."
(append
'("log" "--no-color")
(when (and vc-git-print-log-follow
- (not (cl-some #'file-directory-p files)))
- ;; "--follow" on directories is broken
+ (null (cdr files))
+ (not (file-directory-p (car files))))
+ ;; "--follow" on directories or multiple files is broken
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=8756
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=16422
(list "--follow"))