From: Sean Whitton <spwhitton@spwhitton.name>
To: Juri Linkov <juri@linkov.net>, Dmitry Gutov <dgutov@yandex.ru>,
59414@debbugs.gnu.org
Subject: bug#59414: 29.0.50; Have vc-git-expanded-log-entry pass --stat
Date: Sun, 04 Dec 2022 15:57:52 -0700 [thread overview]
Message-ID: <877cz6zsi7.fsf@melete.silentflame.com> (raw)
In-Reply-To: <86h6ybgf40.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 04 Dec 2022 21:19:51 +0200")
[-- Attachment #1: Type: text/plain, Size: 51 bytes --]
Hello,
Thanks. Here's a patch.
--
Sean Whitton
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Improve-passing-user-switches-to-Git-log-commands.patch --]
[-- Type: text/x-patch, Size: 5605 bytes --]
From 868141665504d689f8f02bc8c67391b63d8962b2 Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhitton@spwhitton.name>
Date: Sun, 4 Dec 2022 15:56:35 -0700
Subject: [PATCH] Improve passing user switches to Git log commands
* lisp/vc/vc-git.el (vc-git-log-switches): Revise docstring.
(vc-git-shortlog-switches): New defcustom.
(vc-git-print-log): Use vc-git-log-switches or
vc-git-shortlog-switches depending on whether printing a shortlog.
(vc-git-log-outgoing, vc-git-log-incoming): Use
vc-git-shortlog-switches.
(vc-git-log-search, vc-git-expanded-log-entry): Use
vc-git-log-switches.
* etc/NEWS: Document the new defcustom.
---
etc/NEWS | 7 ++++++
lisp/vc/vc-git.el | 57 +++++++++++++++++++++++++++++------------------
2 files changed, 42 insertions(+), 22 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 9b8edde5155..8f5b17fb4af 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -41,6 +41,13 @@ connection.
\f
* Changes in Specialized Modes and Packages in Emacs 30.1
+** VC
+
+---
+*** New user option 'vc-git-shortlog-switches'
+String or list of strings giving Git log switches for shortlogs, such
+as 'C-x v L'. 'vc-git-log-switches' is no longer used for shortlogs.
+
\f
* New Modes and Packages in Emacs 30.1
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 38e9d5f9c91..59dfb6c1252 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -136,12 +136,19 @@ vc-git-annotate-switches
;;;###autoload(put 'vc-git-annotate-switches 'safe-local-variable (lambda (switches) (equal switches "-w")))
(defcustom vc-git-log-switches nil
- "String or list of strings specifying switches for Git log under VC."
+ "String or list of strings giving Git log switches for non-shortlogs."
:type '(choice (const :tag "None" nil)
(string :tag "Argument String")
(repeat :tag "Argument List" :value ("") string))
:version "28.1")
+(defcustom vc-git-shortlog-switches nil
+ "String or list of strings giving Git log switches for shortlogs."
+ :type '(choice (const :tag "None" nil)
+ (string :tag "Argument String")
+ (repeat :tag "Argument List" :value ("") string))
+ :version "30.1")
+
(defcustom vc-git-resolve-conflicts t
"When non-nil, mark conflicted file as resolved upon saving.
That is performed after all conflict markers in it have been
@@ -1325,7 +1332,8 @@ vc-git-print-log
,(format "--pretty=tformat:%s"
(car vc-git-root-log-format))
"--abbrev-commit"))
- (ensure-list vc-git-log-switches)
+ (ensure-list
+ (if shortlog vc-git-shortlog-switches vc-git-log-switches))
(when (numberp limit)
(list "-n" (format "%s" limit)))
(when start-revision
@@ -1340,16 +1348,16 @@ vc-git-print-log
(defun vc-git-log-outgoing (buffer remote-location)
(vc-setup-buffer buffer)
- (vc-git-command
- buffer 'async nil
- "log"
- "--no-color" "--graph" "--decorate" "--date=short"
- (format "--pretty=tformat:%s" (car vc-git-root-log-format))
- "--abbrev-commit"
- (concat (if (string= remote-location "")
- "@{upstream}"
- remote-location)
- "..HEAD")))
+ (apply #'vc-git-command buffer 'async nil
+ `("log"
+ "--no-color" "--graph" "--decorate" "--date=short"
+ ,(format "--pretty=tformat:%s" (car vc-git-root-log-format))
+ "--abbrev-commit"
+ ,@(ensure-list vc-git-shortlog-switches)
+ ,(concat (if (string= remote-location "")
+ "@{upstream}"
+ remote-location)
+ "..HEAD"))))
(defun vc-git-log-incoming (buffer remote-location)
(vc-setup-buffer buffer)
@@ -1359,15 +1367,15 @@ vc-git-log-incoming
;; so remove everything except a repository name.
(replace-regexp-in-string
"/.*" "" remote-location)))
- (vc-git-command
- buffer 'async nil
- "log"
- "--no-color" "--graph" "--decorate" "--date=short"
- (format "--pretty=tformat:%s" (car vc-git-root-log-format))
- "--abbrev-commit"
- (concat "HEAD.." (if (string= remote-location "")
- "@{upstream}"
- remote-location))))
+ (apply #'vc-git-command buffer 'async nil
+ `("log"
+ "--no-color" "--graph" "--decorate" "--date=short"
+ ,(format "--pretty=tformat:%s" (car vc-git-root-log-format))
+ "--abbrev-commit"
+ ,@(ensure-list vc-git-shortlog-switches)
+ ,(concat "HEAD.." (if (string= remote-location "")
+ "@{upstream}"
+ remote-location)))))
(defun vc-git-log-search (buffer pattern)
"Search the log of changes for PATTERN and output results into BUFFER.
@@ -1378,6 +1386,7 @@ vc-git-log-search
With a prefix argument, ask for a command to run that will output
log entries."
(let ((args `("log" "--no-color" "-i"
+ ,@(ensure-list vc-git-log-switches)
,(format "--grep=%s" (or pattern "")))))
(when current-prefix-arg
(setq args (cdr (split-string
@@ -1462,7 +1471,11 @@ vc-git-show-log-entry
(defun vc-git-expanded-log-entry (revision)
(with-temp-buffer
- (apply #'vc-git-command t nil nil (list "log" revision "-1" "--no-color" "--"))
+ (apply #'vc-git-command t nil nil
+ `("log"
+ ,revision
+ "-1" "--no-color" ,@(ensure-list vc-git-log-switches)
+ "--"))
(goto-char (point-min))
(unless (eobp)
;; Indent the expanded log entry.
--
2.30.2
next prev parent reply other threads:[~2022-12-04 22:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-20 17:35 bug#59414: 29.0.50; Have vc-git-expanded-log-entry pass --stat Sean Whitton
2022-11-20 17:52 ` Juri Linkov
2022-11-20 20:14 ` Dmitry Gutov
2022-11-20 21:58 ` Sean Whitton
2022-11-20 22:11 ` Dmitry Gutov
2022-11-21 20:29 ` Sean Whitton
2022-12-03 7:04 ` Sean Whitton
2022-12-04 19:19 ` Juri Linkov
2022-12-04 22:57 ` Sean Whitton [this message]
2022-12-05 0:54 ` Dmitry Gutov
2022-12-05 5:09 ` Sean Whitton
2022-12-05 12:29 ` Eli Zaretskii
2022-12-05 12:40 ` Dmitry Gutov
2022-12-05 12:57 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877cz6zsi7.fsf@melete.silentflame.com \
--to=spwhitton@spwhitton.name \
--cc=59414@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=juri@linkov.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.