diff options
author | Gustav Hållberg <gustav@gmail.com> | 2012-04-06 21:32:24 +0200 |
---|---|---|
committer | Gustav Hållberg <gustav@gmail.com> | 2012-04-09 09:23:19 +0200 |
commit | 6ed62181f588486af22acd083f2ab7e4eb17a838 (patch) | |
tree | 246c85a4eeb4f8718e1698ad21d4eeeb6ea445af | |
parent | f282cf8b4e66f64f66672b5856eece0224c41abf (diff) | |
download | stgit-6ed62181f588486af22acd083f2ab7e4eb17a838.tar.gz |
stgit.el: Add and use stgit-assert-no-unmerged-changes
Signed-off-by: Gustav Hållberg <gustav@gmail.com>
-rw-r--r-- | contrib/stgit.el | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/contrib/stgit.el b/contrib/stgit.el index 27a0d70..8ea6a68 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -2367,6 +2367,12 @@ If FORCE is not nil, use --force." "--quiet" "HEAD"))))) result)) +(defun stgit-assert-no-unmerged-changes () + "Signal an error if there are any unmerged changes in the index." + (when (stgit-git-index-unmerged-p) + (error (substitute-command-keys + "Resolve unmerged changes with \\[stgit-resolve-file] first")))) + (defun stgit-file-toggle-index () "Move modified file in or out of the index. @@ -2419,8 +2425,7 @@ file ended up. You can then jump to the file with \ (let ((patch-name (stgit-patch-name-at-point))) (unless (memq patch-name '(:index :work)) (error "Can only move changes between working tree and index")) - (when (stgit-git-index-unmerged-p) - (error "Resolve unmerged changes with \\[stgit-resolve-file] first")) + (stgit-assert-no-unmerged-changes) (if (if (eq patch-name :index) (stgit-index-empty-p) (stgit-work-tree-empty-p)) @@ -2497,6 +2502,7 @@ end of the patch. This works just like running `stgit-new' followed by `stgit-refresh'." (interactive "P") (stgit-assert-mode) + (stgit-assert-no-unmerged-changes) (stgit-new add-sign t)) (defun stgit-create-patch-name (description) @@ -2787,6 +2793,7 @@ If the index contains any changes, only refresh from index. With prefix argument, refresh the marked patch or the patch under point." (interactive "P") (stgit-assert-mode) + (stgit-assert-no-unmerged-changes) (let ((patchargs (if arg (let ((patches (stgit-patches-marked-or-at-point t t))) (when (> (length patches) 1) |