[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/magit ec1f403af1 2/8: magit-toggle-subprocess-record: New
From: |
Jonas Bernoulli |
Subject: |
[nongnu] elpa/magit ec1f403af1 2/8: magit-toggle-subprocess-record: New command |
Date: |
Mon, 23 Dec 2024 16:44:25 -0500 (EST) |
branch: elpa/magit
commit ec1f403af1f8b85f5b12dd35fcd77bb4df31b7a8
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
magit-toggle-subprocess-record: New command
This is a refinement of the functionality, which was previously
enabled using the variable `magit-process-extreme-logging' (which
we remove).
---
CHANGELOG | 2 ++
docs/magit.org | 22 ++++++++++++----------
docs/magit.texi | 22 ++++++++++++----------
lisp/magit-process.el | 48 ++++++++++++++++++++++++++++++++----------------
4 files changed, 58 insertions(+), 36 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index a18aadbca1..5cb81a1d81 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,8 @@
- Added new command ~magit-toggle-profiling~. f637dd1877
+- Added new command ~magit-toggle-subprocess-record~.
+
Bug fixes:
- Fixed a regression in ~transient-init-value~. 5b4c4aea1b
diff --git a/docs/magit.org b/docs/magit.org
index 0388715637..06ae0d3479 100644
--- a/docs/magit.org
+++ b/docs/magit.org
@@ -1863,16 +1863,6 @@ sections are available. There is one additional command.
relevant in the context of some unexpected behavior has to be judged
on a case by case basis.
-- Variable: magit-process-extreme-logging ::
-
- This option controls whether ~magit-process-file~ logs to the
- ~*Messages*~ buffer.
-
- Only intended for temporary use when you try to figure out how
- Magit uses Git behind the scene. Output that normally goes to
- the magit-process buffer continues to go there. Not all output
- goes to either of these two buffers.
-
*** Git Process Status
When a Git process is running for side-effects, Magit displays an
@@ -9348,6 +9338,18 @@ issue.
Enabling this helps figuring out which sections are bottlenecks.
The additional output can be found in the ~*Messages*~ buffer.
+- Key: M-x magit-toggle-subprocess-record ::
+
+ This command toggles whether subprocess invocations are recorded.
+
+ When enabled, all subprocesses started by ~magit-process-file~ are
+ logged into the buffer specified by ~magit-process-record-buffer-name~
+ using the format ~magit-process-record-entry-format~. This is for
+ debugging purposes.
+
+ This is in addition to and distinct from the default logging done by
+ default, and additional logging enabled with ~magit-toggle-git-debug~.
+
- Key: M-x magit-debug-git-executable ::
This command displays a buffer containing information about the
diff --git a/docs/magit.texi b/docs/magit.texi
index a9321ddad9..2d4a0b5563 100644
--- a/docs/magit.texi
+++ b/docs/magit.texi
@@ -2399,16 +2399,6 @@ relevant in the context of some unexpected behavior has
to be judged
on a case by case basis.
@end table
-@defvar magit-process-extreme-logging
-This option controls whether @code{magit-process-file} logs to the
-@code{*Messages*} buffer.
-
-Only intended for temporary use when you try to figure out how
-Magit uses Git behind the scene. Output that normally goes to
-the magit-process buffer continues to go there. Not all output
-goes to either of these two buffers.
-@end defvar
-
@node Git Process Status
@subsection Git Process Status
@@ -11434,6 +11424,18 @@ This command toggles whether Magit refreshes buffers
verbosely.
Enabling this helps figuring out which sections are bottlenecks.
The additional output can be found in the @code{*Messages*} buffer.
+@item @kbd{M-x magit-toggle-subprocess-record}
+@findex magit-toggle-subprocess-record
+This command toggles whether subprocess invocations are recorded.
+
+When enabled, all subprocesses started by @code{magit-process-file} are
+logged into the buffer specified by @code{magit-process-record-buffer-name}
+using the format @code{magit-process-record-entry-format}. This is for
+debugging purposes.
+
+This is in addition to and distinct from the default logging done by
+default, and additional logging enabled with @code{magit-toggle-git-debug}.
+
@item @kbd{M-x magit-debug-git-executable}
@findex magit-debug-git-executable
This command displays a buffer containing information about the
diff --git a/lisp/magit-process.el b/lisp/magit-process.el
index 953086b929..6570b776aa 100644
--- a/lisp/magit-process.el
+++ b/lisp/magit-process.el
@@ -38,6 +38,7 @@
(require 'auth-source)
(require 'with-editor)
+(defvar messages-buffer-name)
(defvar y-or-n-p-map)
;;; Options
@@ -92,16 +93,6 @@ When this is nil, no sections are ever removed."
:group 'magit-process
:type '(choice (const :tag "Never remove old sections" nil) integer))
-(defvar magit-process-extreme-logging nil
- "Whether `magit-process-file' logs to the *Messages* buffer.
-
-Only intended for temporary use when you try to figure out how
-Magit uses Git behind the scene. Output that normally goes to
-the magit-process buffer continues to go there. Not all output
-goes to either of these two buffers.
-
-Also see `magit-git-debug'.")
-
(defcustom magit-process-error-tooltip-max-lines 20
"The number of lines for `magit-process-error-lines' to return.
@@ -371,6 +362,27 @@ optional NODISPLAY is non-nil also display it."
(defvar magit-process-raise-error nil)
+(defvar magit-process-record-invocations nil)
+(defvar magit-process-record-buffer-name " *magit-process-file record*")
+(defvar magit-process-record-entry-format "%T %%d $ %%a")
+
+(defun magit-toggle-subprocess-record ()
+ "Toggle whether subprocess invocations are recorded.
+
+When enabled, all subprocesses started by `magit-process-file' are
+logged into the buffer specified by `magit-process-record-buffer-name'
+using the format `magit-process-record-entry-format'. This is for
+debugging purposes.
+
+This is in addition to and distinct from the default logging done by
+default, and additional logging enabled with ~magit-toggle-git-debug~.
+
+For alternatives, see info node `(magit)Debugging Tools'."
+ (interactive)
+ (setq magit-process-record-invocations (not
magit-process-record-invocations))
+ (message "Recording of subprocess invocations %s"
+ (if magit-process-record-invocations "enabled" "disabled")))
+
(defun magit-git (&rest args)
"Call Git synchronously in a separate process, for side-effects.
@@ -446,12 +458,16 @@ ensure unix eol conversion."
(defun magit-process-file (process &optional infile buffer display &rest args)
"Process files synchronously in a separate process.
-Identical to `process-file' but temporarily enable Cygwin's
-\"noglob\" option during the call and ensure unix eol
-conversion."
- (when magit-process-extreme-logging
- (let ((inhibit-message t))
- (message "$ %s" (magit-process--format-arguments process args))))
+Similar to `process-file' but temporarily enable Cygwin's
+\"noglob\" option during the call and ensure unix eol conversion."
+ (when magit-process-record-invocations
+ (let ((messages-buffer-name magit-process-record-buffer-name)
+ (inhibit-message t))
+ (message "%s"
+ (format-spec
+ (format-time-string magit-process-record-entry-format)
+ `((?d . ,(abbreviate-file-name default-directory))
+ (?a . ,(magit-process--format-arguments process args)))))))
(let ((process-environment (magit-process-environment))
(default-process-coding-system (magit--process-coding-system)))
(apply #'process-file process infile buffer display args)))
- [nongnu] elpa/magit updated (fbb6addae6 -> 692cc5e769), Jonas Bernoulli, 2024/12/23
- [nongnu] elpa/magit 2e38d10286 3/8: manual: Fix two urls, Jonas Bernoulli, 2024/12/23
- [nongnu] elpa/magit bfbab898a8 4/8: manual: Copyedit FAQ a bit, Jonas Bernoulli, 2024/12/23
- [nongnu] elpa/magit 5cb3492464 7/8: magit-format-ref-labels: Don't strip "heads/" if tag name conflicts, Jonas Bernoulli, 2024/12/23
- [nongnu] elpa/magit 30392f4af0 6/8: magit-format-ref-labels: Cosmetics, Jonas Bernoulli, 2024/12/23
- [nongnu] elpa/magit ee7a2499cf 1/8: magit-toggle-git-debug: Improve documentation, Jonas Bernoulli, 2024/12/23
- [nongnu] elpa/magit ec1f403af1 2/8: magit-toggle-subprocess-record: New command,
Jonas Bernoulli <=
- [nongnu] elpa/magit e4e46a775d 5/8: magit-format-ref-labels: Remove ancient kludge, Jonas Bernoulli, 2024/12/23
- [nongnu] elpa/magit 692cc5e769 8/8: magit-list-special-refnames: Fix broken function, Jonas Bernoulli, 2024/12/23