aboutsummaryrefslogtreecommitdiff
path: root/lisp/magit-git.el
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2025-03-31 11:35:00 +0200
committerJonas Bernoulli <jonas@bernoul.li>2025-03-31 11:35:00 +0200
commit4255895657373bea08fcb775d1552ac652f1253c (patch)
tree310095346ca9ee9f96ae7af5b47f547911d03cef /lisp/magit-git.el
parent88464b5363675d9fda27f4275d79fae96cbc6408 (diff)
magit-git-wash: Always keep error output
Remove the variable `magit--git-wash-keep-error' which previously could be used to disable that. The variable was added in [1: 78a979fde5] and its value was changed to t in [2: 76253bda0d]. This has generally held up well enough to be permanently enabled. Function `magit--git-wash', which was added in [1: 78a979fde5], can be used in cases where the section should be canceled in case of an error. Also extend the docstrings of these two functions. 1: 2023-03-18 78a979fde52815242b165f083d171259db28e0b4 Support displaying errors that occur when washing a section 2: 2024-11-15 76253bda0d05d252e118e56955447b6e4d6c0535 magit--git-wash-keep-error: Enable by default
Diffstat (limited to 'lisp/magit-git.el')
-rw-r--r--lisp/magit-git.el24
1 files changed, 16 insertions, 8 deletions
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 41587bc..d432531 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -543,18 +543,26 @@ a section in the respective process buffer."
(apply #'magit-git-insert args)
(split-string (buffer-string) "\0" t)))
-(defvar magit--git-wash-keep-error t)
-
(defun magit-git-wash (washer &rest args)
- "Execute Git with ARGS, inserting washed output at point.
-Actually first insert the raw output at point. If there is no
-output, call `magit-cancel-section'. Otherwise temporarily narrow
-the buffer to the inserted text, move to its beginning, and then
-call function WASHER with ARGS as its sole argument."
+ "Execute git with ARGS, inserting washed output at point.
+
+First insert the raw output at point. If there is no output, call
+`magit-cancel-section'. Otherwise temporarily narrow the buffer to
+the inserted text, move to its beginning, and finally call function
+WASHER with ARGS as its sole argument.
+
+If git exits with a non-zero exit status, apply the `error' face to
+the error message, instead of calling WASHER. To instead cancel the
+section use `magit--git-wash'."
(declare (indent 1))
- (apply #'magit--git-wash washer magit--git-wash-keep-error args))
+ (apply #'magit--git-wash washer t args))
(defun magit--git-wash (washer keep-error &rest args)
+ "Execute git with ARGS, inserting washed output at point.
+
+Like `magit-git-wash' but if KEEP-ERROR is nil and an error occurs, also
+insert standard error. If KEEP-ERROR is `wash-anyway', insert and wash
+standard output even in case of an error."
(declare (indent 2))
(setq args (flatten-tree args))
(let ((beg (point))