When magit-commit-all-when-nothing-staged is nil and nothing is
staged, magit-log-edit pops up a buffer and attempts to commit
anyway. Change this behavior to display an error instead.

Signed-off-by: Ramkumar Ramachandra <[email protected]>
---
 magit.el |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/magit.el b/magit.el
index 596b899..250fee8 100644
--- a/magit.el
+++ b/magit.el
@@ -3207,7 +3207,10 @@ Prefix arg means justify as well."
                           (y-or-n-p
                            "Nothing staged.  Commit all unstaged changes? "))
                       "yes" "no")))))
-        (magit-pop-to-log-edit "commit"))))
+        (if (and (eq magit-commit-all-when-nothing-staged nil)
+                 (not (magit-anything-staged-p)))
+            (error "Nothing staged")
+            (magit-pop-to-log-edit "commit")))))
 
 (defun magit-add-log ()
   (interactive)
-- 
1.7.1

Reply via email to