Fix mode line process status.

* magit.el (magit-prefix-p): Compare components with equal so that it
works for strings.
(magit-process-indicator-from-command): Take
magit-git-standard-options into account when choping off the head.
This commit is contained in:
Marius Vollmer 2009-02-16 00:29:45 +02:00
parent bded317bc8
commit cdc036915f

View file

@ -793,7 +793,7 @@ Many Magit faces inherit from this one by default."
(and (not (null list)) (and (not (null list))
(magit-prefix-p prefix (cdr list)))) (magit-prefix-p prefix (cdr list))))
(and (not (null list)) (and (not (null list))
(eq (car prefix) (car list)) (equal (car prefix) (car list))
(magit-prefix-p (cdr prefix) (cdr list)))))) (magit-prefix-p (cdr prefix) (cdr list))))))
(defmacro magit-section-case (head &rest clauses) (defmacro magit-section-case (head &rest clauses)
@ -839,15 +839,15 @@ Many Magit faces inherit from this one by default."
(magit-for-all-buffers (lambda () (magit-for-all-buffers (lambda ()
(setq mode-line-process pr)))))) (setq mode-line-process pr))))))
(defun magit-process-indicator-from-command (cmd args) (defun magit-process-indicator-from-command (comps)
(cond ((or (null args) (if (magit-prefix-p (cons magit-git-executable magit-git-standard-options)
(not (equal cmd magit-git-executable))) comps)
cmd) (setq comps (nthcdr (+ (length magit-git-standard-options) 1) comps)))
((or (null (cdr args)) (cond ((or (null (cdr comps))
(not (member (car args) '("remote")))) (not (member (car comps) '("remote"))))
(car args)) (car comps))
(t (t
(concat (car args) " " (cadr args))))) (concat (car comps) " " (cadr comps)))))
(defvar magit-process nil) (defvar magit-process nil)
(defvar magit-process-client-buffer nil) (defvar magit-process-client-buffer nil)
@ -862,8 +862,7 @@ Many Magit faces inherit from this one by default."
(or (not magit-process) (or (not magit-process)
(error "Git is already running.")) (error "Git is already running."))
(magit-set-mode-line-process (magit-set-mode-line-process
(magit-process-indicator-from-command (magit-process-indicator-from-command cmd-and-args))
(car cmd-and-args) (cdr cmd-and-args)))
(setq magit-process-client-buffer (current-buffer)) (setq magit-process-client-buffer (current-buffer))
(save-excursion (save-excursion
(set-buffer buf) (set-buffer buf)