From f87c2e22b60b3dade7812e5bfce86b848f2efebc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gustav=20H=C3=A5llberg?= Date: Wed, 5 Aug 2009 22:53:18 +0200 Subject: [PATCH] stgit.el: Allow moving ignored files to index MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Gustav HÃ¥llberg --- contrib/stgit.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/contrib/stgit.el b/contrib/stgit.el index bcfa596..73d575b 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -1188,12 +1188,15 @@ greater than four (e.g., \\[universal-argument] \ "--cc" "show a combined diff") -(defun stgit-move-change-to-index (file) - "Copies the workspace state of FILE to index, using git add or git rm" +(defun stgit-move-change-to-index (file &optional force) + "Copies the work tree state of FILE to index, using git add or git rm. + +If FORCE is not nil, use --force." (let ((op (if (or (file-exists-p file) (file-symlink-p file)) '("add") '("rm" "-q")))) (stgit-capture-output "*git output*" - (apply 'stgit-run-git (append op '("--") (list file)))))) + (apply 'stgit-run-git (append op (and force '("--force")) + '("--") (list file)))))) (defun stgit-remove-change-from-index (file) "Unstages the change in FILE from the index" @@ -1212,8 +1215,6 @@ file ended up. You can then jump to the file with \ (patched-status (stgit-file-status patched-file))) (when (eq patched-status 'unmerged) (error (substitute-command-keys "Use \\[stgit-resolve-file] to move an unmerged file to the index"))) - (when (eq patched-status 'ignore) - (error "You cannot add ignored files to the index")) (let* ((patch (stgit-patch-at-point)) (patch-name (stgit-patch-name patch)) (mark-file (if (eq patched-status 'rename) @@ -1224,7 +1225,8 @@ file ended up. You can then jump to the file with \ (stgit-neighbour-file)))) (cond ((eq patch-name :work) - (stgit-move-change-to-index (stgit-file-file patched-file))) + (stgit-move-change-to-index (stgit-file-file patched-file) + (eq patched-status 'ignore))) ((eq patch-name :index) (stgit-remove-change-from-index (stgit-file-file patched-file))) (t -- 2.11.0