I know, people shouldn't be deleting the master branch, but that doesn't mean we should offer to switch to it when we're already on it...
Signed-off-by: Pieter Praet <[email protected]> --- magit.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/magit.el b/magit.el index d6fad88..d6f0bfc 100644 --- a/magit.el +++ b/magit.el @@ -4779,7 +4779,9 @@ (defun magit-delete-branch (branch &optional force) (interactive (list (magit-read-rev-with-default "Branch to delete" 'notrim) current-prefix-arg)) (let* ((remote (magit-remote-part-of-branch branch)) - (is-current (string= branch (magit-get-current-branch))) + (current (magit-get-current-branch)) + (is-current (string= branch current)) + (is-master (string= branch "master")) (args (list "branch" (if force "-D" "-d") branch))) @@ -4788,6 +4790,8 @@ (defun magit-delete-branch (branch &optional force) (magit-run-git-async "push" remote (concat ":refs/heads/" (magit-branch-no-remote branch)))) + ((and is-current is-master) + (message "Cannot delete master branch while it's checked out.")) (is-current (if (y-or-n-p "Cannot delete current branch. Switch to master first? ") (progn -- 1.7.11.1 -- --- You received this message because you are subscribed to the Google Groups "magit" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
