Ramkumar Ramachandra <[email protected]> writes:

> 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")))))

I object to this patch. When I want to amend the message of a commit, I
always start an empty commit, then tell magit it is an amendment with
C-cC-a, I would be really disappointed if magit would forbid this to me.

It's only when committing that the test should be done, not when
starting to edit the commit.
-- 
Rémi Vanicat

Reply via email to