Make magit-run* look in the magit-process-buffer for a useful error

string when reporting an error, and fall back on the less helpful "Git
failed" message only if no error message could be found in the buffer.
This commit is contained in:
Aaron Culich 2010-09-20 22:01:28 -07:00 committed by Phil Jackson
parent 17753d31fd
commit 36ace412b6

View file

@ -1640,7 +1640,13 @@ FUNC should leave point at the end of the modified region"
(magit-need-refresh magit-process-client-buffer))))
(or successp
noerror
(error "Git failed"))
(error
(or (save-excursion
(set-buffer (get-buffer magit-process-buffer-name))
(when (re-search-backward
(concat "^error: \\(.*\\)" paragraph-separate) nil t)
(match-string 1)))
"Git failed")))
successp)))
(autoload 'dired-uncache "dired")