From 8912ac22fc67890ebad2f171643f3f295ab78e54 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Sat, 30 Aug 2008 22:34:40 +0300 Subject: [PATCH] New magit-run-shell utility. * magit.el (magit-run-command): Renamed from magit-run, explicitly take line to log in the buffer. (magit-run): Use it. (magit-run-shell): New, use it as well. --- magit.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/magit.el b/magit.el index 8f540a6e..cf28a7fa 100644 --- a/magit.el +++ b/magit.el @@ -460,7 +460,7 @@ Many Magit faces inherit from this one by default." (defvar magit-process nil) -(defun magit-run (cmd &rest args) +(defun magit-run-command (logline cmd &rest args) (or (not magit-process) (error "Git is already running.")) (let ((dir default-directory) @@ -472,10 +472,19 @@ Many Magit faces inherit from this one by default." (set-buffer buf) (setq default-directory dir) (erase-buffer) - (insert "$ " (magit-concat-with-delim " " (cons cmd args)) "\n") + (insert "$ " logline "\n") (setq magit-process (apply 'start-process "git" buf cmd args)) (set-process-sentinel magit-process 'magit-process-sentinel)))) +(defun magit-run (cmd &rest args) + (apply #'magit-run-command + (magit-concat-with-delim " " (cons cmd args)) + cmd args)) + +(defun magit-run-shell (fmt &rest args) + (let ((cmd (apply #'format fmt args))) + (magit-run-command cmd "sh" "-c" cmd))) + (defun magit-revert-files () (let ((files (magit-shell-lines "git ls-files"))) (dolist (file files) @@ -1043,7 +1052,7 @@ Please see the manual for a complete description of Magit. ((commit) (magit-append-to-log-edit (magit-format-commit info "%s%n%n%b%n(Cherrypicked from %H)")) - (magit-run-shell "git diff %s^ %s | git apply -")))) + (magit-run-shell "git diff %s^ %s | git apply -" info info)))) (defun magit-cherry-pick () (interactive)