Commit Diff


commit - 21914ca959126b8333895482e7d23a4a00cb90d3
commit + 5dec261eef82fd84ad75a51f7060e840b01183a6
blob - 4331ad527e62fd19dd81e1fb653ff7e728c8bfc9
blob + 4560aea3659d5256e46eb6c0a75032ca4075eaf7
--- vc-got-stage.el
+++ vc-got-stage.el
@@ -26,6 +26,7 @@ Higher values means higher priority.  DON'T use negati
 (defvar vc-got-stage-prefix-map
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "A") #'vc-got-stage-apply)
+    (define-key map (kbd "U") #'vc-got-unstage-all)
     (define-key map (kbd "b") #'vc-got-stage-beginning-of-change)
     (define-key map (kbd "e") #'vc-got-stage-end-of-change)
     (define-key map (kbd "n") #'vc-got-stage-next-change)
@@ -90,14 +91,22 @@ Higher values means higher priority.  DON'T use negati
           (with-current-buffer buf
             (insert "n\n")))))))
 
+(defun vc-got-stage-unstage-all ()
+  (interactive)
+  (let* ((default-directory (vc-find-root default-directory ".got"))
+         (unstage-buf       (get-buffer-create "*vc-got-unstage*")))
+    (unless (zerop (apply #'process-file "got" nil unstage-buf nil
+                          "unstage" (mapcar #'file-relative-name
+                                            vc-got-stage-fileset)))
+      (pop-to-buffer unstage-buf)
+      (error "Got unstage failed"))
+    (kill-buffer unstage-buf)))
+
 (defun vc-got-stage--apply-impl (script tmp-file)
   "Apply the stages using SCRIPT as script (TMP-FILE is the path)."
   (let* ((default-directory (vc-find-root default-directory ".got"))
          (stage-buf         (get-buffer-create "*vc-got-stage*")))
-    (unless (zerop (apply #'process-file "got" nil stage-buf nil "unstage"
-                          (mapcar #'file-relative-name vc-got-stage-fileset)))
-      (pop-to-buffer stage-buf)
-      (error "Got unstage failed"))
+    (vc-got-stage-unstage-all)
     (vc-got-stage--compute-y-or-n script)
     (with-current-buffer script
       (save-buffer))
@@ -105,7 +114,8 @@ Higher values means higher priority.  DON'T use negati
                           "-F" tmp-file (mapcar #'file-relative-name
                                                 vc-got-stage-fileset)))
       (pop-to-buffer stage-buf)
-      (error "Got stage failed"))))
+      (error "Got stage failed"))
+    (kill-buffer stage-buf)))
 
 (defun vc-got-stage-apply ()
   "Apply the stages.