commit daae979d49408c97d6ed40de4a1aad4c2304c91d from: Omar Polo date: Mon Jan 04 14:07:56 2021 UTC implement vc-got-stage-commit to commit staged changes commit - eacbf767c64ccb8c469698044c691c7baa3b20a4 commit + daae979d49408c97d6ed40de4a1aad4c2304c91d blob - 489c18fc4d59070afd28ca6203d95e171895e97a blob + 461b819de56778d85021c557f370d405b6ee0fc0 --- vc-got-stage.el +++ vc-got-stage.el @@ -25,12 +25,14 @@ ;;; Code: +(require 'log-edit) (require 'rx) (require 'vc) (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-checkin "vc-got" (fileset comment)) (defvar vc-got-stage--process nil "The got stage process.") @@ -127,5 +129,21 @@ If FILESET is nil, show the diff for every staged hunk (vc-got--diff "-s" file)) (vc-got--diff "-s"))))) +(defun vc-got-stage-commit () + "Commit staged hunks." + (interactive) + (let ((buf (get-buffer-create "*vc-got-stage-commit*"))) + (pop-to-buffer buf) + (log-edit (lambda () + (interactive) + (let ((msg (buffer-substring-no-properties (point-min) + (point-max)))) + (kill-buffer) + (vc-got-checkin nil msg))) + t + ;; TODO: add here an alist of + ;; '((vc-log-fileset . (staged-files))) + ))) + (provide 'vc-got-stage) ;;; vc-got-stage.el ends here blob - 32a11f72a6c4ea4dee043dc99a9a350e5785d8cb blob + f088f2d8442680b54851e5184feded08b0b0c318 --- vc-got.el +++ vc-got.el @@ -447,6 +447,10 @@ tree." (defalias 'vc-got-responsible-p #'vc-got-root) +;; XXX: generally speaking, files cannot be nil. But we have to +;; handle that case too, because vc-got-stage-commit will call +;; vc-got-checking with fileset nil to commit the current staged +;; hunks. (defun vc-got-checkin (files comment &optional _rev) "Commit FILES with COMMENT as commit message." (with-temp-buffer