aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Steingold2016-11-14 23:37:33 -0500
committerSam Steingold2016-11-14 23:37:33 -0500
commit8663fad0a70e60e130ae4cd0529ead66fbad2250 (patch)
tree1628f1c45d6d5c81026bec5bd807400b7d177168
parent1f97c37bc6fb8cfd60731cef8df0aebdd509f23d (diff)
downloademacs-8663fad0a70e60e130ae4cd0529ead66fbad2250.tar.gz
emacs-8663fad0a70e60e130ae4cd0529ead66fbad2250.zip
add `vc-git-print-log-follow' and use it in `vc-git-print-log'
When `vc-git-print-log-follow' is true and all files are non-directory, pass "--follow" to "git log". This works around bug#8756 and bug#16422.
-rw-r--r--lisp/vc/vc-git.el13
1 files changed, 12 insertions, 1 deletions
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 6d451be2688..9df581dda5b 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -886,6 +886,11 @@ This prompts for a branch to merge from."
886 886
887(autoload 'vc-setup-buffer "vc-dispatcher") 887(autoload 'vc-setup-buffer "vc-dispatcher")
888 888
889(defcustom vc-git-print-log-follow nil
890 "If true, follow renames in Git logs for files."
891 :type 'boolean
892 :version "26.1")
893
889(defun vc-git-print-log (files buffer &optional shortlog start-revision limit) 894(defun vc-git-print-log (files buffer &optional shortlog start-revision limit)
890 "Print commit log associated with FILES into specified BUFFER. 895 "Print commit log associated with FILES into specified BUFFER.
891If SHORTLOG is non-nil, use a short format based on `vc-git-root-log-format'. 896If SHORTLOG is non-nil, use a short format based on `vc-git-root-log-format'.
@@ -905,7 +910,13 @@ If LIMIT is non-nil, show no more than this many entries."
905 (apply 'vc-git-command buffer 910 (apply 'vc-git-command buffer
906 'async files 911 'async files
907 (append 912 (append
908 '("log" "--no-color" "--follow") 913 '("log" "--no-color")
914 (when (and vc-git-print-log-follow
915 (not (cl-some #'file-directory-p files)))
916 ;; "--follow" on directories is broken
917 ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=8756
918 ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=16422
919 (list "--follow"))
909 (when shortlog 920 (when shortlog
910 `("--graph" "--decorate" "--date=short" 921 `("--graph" "--decorate" "--date=short"
911 ,(format "--pretty=tformat:%s" 922 ,(format "--pretty=tformat:%s"