Commit Diff


commit - cf4e3ebe40038ce0bfff250a345070556b386fe1
commit + a323f6038c66d12f4a3f5b4c136b7bfdbc62f405
blob - 461b819de56778d85021c557f370d405b6ee0fc0
blob + 5146237c599a435db382e14925f678bd9fe6cef9
--- vc-got-stage.el
+++ vc-got-stage.el
@@ -32,7 +32,9 @@
 (defvar vc-got-program)                 ;vc-got.el
 (declare-function vc-got--diff    "vc-got")
 (declare-function vc-got--unstage "vc-got" (file))
+(declare-function vc-got--status  "vc-got" (status-codes dir &rest files))
 (declare-function vc-got-checkin  "vc-got" (fileset comment))
+(declare-function vc-got-root     "vc-got" (dir-or-file))
 
 (defvar vc-got-stage--process nil
   "The got stage process.")
@@ -132,7 +134,11 @@ If FILESET is nil, show the diff for every staged hunk
 (defun vc-got-stage-commit ()
   "Commit staged hunks."
   (interactive)
-  (let ((buf (get-buffer-create "*vc-got-stage-commit*")))
+  (let* ((buf (get-buffer-create "*vc-got-stage-commit*"))
+         (status (vc-got--status "M" "."))
+         (staged-files (cl-loop for (file _ staged) in status
+                                when staged
+                                collect file)))
     (pop-to-buffer buf)
     (log-edit (lambda ()
                 (interactive)
@@ -141,9 +147,9 @@ If FILESET is nil, show the diff for every staged hunk
                   (kill-buffer)
                   (vc-got-checkin nil msg)))
               t
-              ;; TODO: add here an alist of
-              ;; '((vc-log-fileset . (staged-files)))
-              )))
+              `((log-edit-listfun . ,(lambda ()
+                                       (mapcar #'file-relative-name
+                                               staged-files)))))))
 
 (provide 'vc-got-stage)
 ;;; vc-got-stage.el ends here