branch: elpa/magit commit 4255895657373bea08fcb775d1552ac652f1253c Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
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 --- lisp/magit-diff.el | 2 +- lisp/magit-git.el | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el index eb904fab58..7e87fa5b33 100644 --- a/lisp/magit-diff.el +++ b/lisp/magit-diff.el @@ -2240,7 +2240,7 @@ keymap is the parent of their keymaps." (magit--git-wash #'magit-diff-wash-diffs (if (member "--no-index" args) 'wash-anyway - (or keep-error magit--git-wash-keep-error)) + (or keep-error t)) cmd args))) (defun magit-diff--maybe-add-stat-arguments (args) diff --git a/lisp/magit-git.el b/lisp/magit-git.el index 41587bc73e..d432531d21 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))