Browse files

Do not raise error from Magit WIP

This change prevent raising error from magit-wip-save which is
executed via after-save-hook, as raising error stops execution of
other hooks or following code.
  • Loading branch information...
1 parent ba5a849 commit 588685b81c0a75f745c6fa3583c409dca2a1d0ef @tkf tkf committed with sigma Sep 12, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 magit-wip.el
@@ -113,8 +113,8 @@ git repository then it is also committed to a special work-in-progress
:lighter magit-wip-save-mode-lighter
(if magit-wip-save-mode
- (add-hook 'after-save-hook 'magit-wip-save t t)
- (remove-hook 'after-save-hook 'magit-wip-save t)))
+ (add-hook 'after-save-hook 'magit-wip-save-safe t t)
+ (remove-hook 'after-save-hook 'magit-wip-save-safe t)))
(define-globalized-minor-mode global-magit-wip-save-mode
@@ -129,6 +129,12 @@ ref."
(magit-wip-save-mode 1)
(message "Git command 'git wip' cannot be found"))))
+(defun magit-wip-save-safe ()
+ (condition-case err
+ (magit-wip-save)
+ (error
+ (message "Magit WIP got an error: %S" err))))
(defun magit-wip-save ()
(let* ((top-dir (magit-get-top-dir default-directory))
(name (file-truename (buffer-file-name)))

0 comments on commit 588685b

Please sign in to comment.