Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add a running log of git command output. #516

Closed
wants to merge 1 commit into from

3 participants

@phil-s

As well as the magit-process buffer (showing the output of the most recent git command), it would be mightily useful if that output was also appended to a magit-process-log buffer, so that we could see things like the commit hash for the stash that we dropped a couple of commands ago, and then realised that we wanted back (for example :)

phil-s/magit@6d0b67d

Branch phil-s/process-log (branched from maint) implements this.

@tarsius
Owner

The change proposed by @phil-s is in #516. Closing this as there is no need to have two issues.

@tarsius tarsius closed this
@phil-s

I know I made a mess of submitting this, but I'm confused by the last comment. You say the proposed change is in #516, but that is THIS issue, which you have just closed as a duplicate (of...?) I thought I'd already closed the duplicates, so it's not clear to me if I'm missing something, or if closing this issue was actually a mistake (although if the latter, it was probably caused by all my initial confusion over how to submit this in the first place!)

@tarsius
Owner

Probably the latter :-/

@tarsius tarsius reopened this
@tarsius
Owner

I could like to have that feature too, but so far did not care to write it.

But I would certainly not mind if someone else wrote it. Unfortunately your implementation is not good enough.

Things that come to mind:

  • default-directory has to be logged
  • a separator like ^L between entries
  • way to limit the number of logs to be kept
  • alternatively log directly to file
  • only log calls to magit-run* "that matter" (good luck with that)
  • (related but not same as above:) only log in certain repositories
  • command to toggle logging
@ncalexan

@tarsius thanks for this excellent list. I picked up the idea of @phil-s and made progress, but will need to consider your suggestions before submitting.

@tarsius
Owner

Please also consider that magit-run* is already a mess, best not to make it any worse :-)

@phil-s

I notice that I messed up by not updating the log buffer in magit-process-sentinel, when the process has exited, meaning that I missed most of the output. I imagine that @ncalexan has done that properly.

@tarsius
Owner

I am closing this as it won't be merged in its current form. @ncalexan please open a new pull request when you are ready.

@tarsius tarsius closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 30, 2012
  1. #505 - Added a running log of git command output.

    Phil Sainty authored
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 0 deletions.
  1. +9 −0 magit.el
View
9 magit.el
@@ -2042,6 +2042,8 @@ function can be enriched by magit extension like magit-topgit and magit-svn"
(defvar magit-process-client-buffer nil)
(defvar magit-process-buffer-name "*magit-process*"
"Buffer name for running git commands.")
+(defvar magit-process-log-buffer-name "*magit-process-log*"
+ "Buffer name for the running log of output from git commands.")
(defun magit-run* (cmd-and-args
&optional logline noerase noerror nowait input)
@@ -2052,6 +2054,7 @@ function can be enriched by magit extension like magit-topgit and magit-svn"
(args (cdr cmd-and-args))
(dir default-directory)
(buf (get-buffer-create magit-process-buffer-name))
+ (log-buf (get-buffer-create magit-process-log-buffer-name))
(successp nil))
(magit-set-mode-line-process
(magit-process-indicator-from-command cmd-and-args))
@@ -2121,6 +2124,12 @@ function can be enriched by magit extension like magit-topgit and magit-svn"
(equal (apply 'process-file cmd nil buf nil args) 0))
(magit-set-mode-line-process nil)
(magit-need-refresh magit-process-client-buffer))))
+ ;; Append the contents of process-buffer to the log.
+ (with-current-buffer log-buf
+ (goto-char (point-max))
+ (insert "\n"))
+ (append-to-buffer log-buf (point-min) (point-max))
+ ;; Raise an error if the command failed.
(or successp
noerror
(error
Something went wrong with that request. Please try again.