summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-10-31 07:05:28 +0200
committerThanos Apollo <[email protected]>2024-10-31 07:05:28 +0200
commitce54993dc3dc28b7a97bbbf165cf82e785d3f291 (patch)
tree88ab5a792b4bf7b2ea14676e16061c4b45d4cc17
parent5ac054b95ed0add400143272941f1d8514122d3e (diff)
review-commit: Use vc-git-command.
* Replace shell-command with vc-git-command
-rw-r--r--gnosis.el17
1 files changed, 7 insertions, 10 deletions
diff --git a/gnosis.el b/gnosis.el
index 6c4fa89..fb1c556 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -46,7 +46,7 @@
(require 'calendar)
(require 'subr-x)
-(require 'vc)
+(require 'vc-git)
(require 'emacsql-sqlite)
(require 'transient)
(require 'animate)
@@ -1760,29 +1760,26 @@ DATE: Date to log the note review on the activity-log."
;; Reopen gnosis-db after pull
(setf gnosis-db (emacsql-sqlite-open (expand-file-name "gnosis.db" dir)))))
-(defun gnosis-review-commit (note-count)
+(defun gnosis-review-commit (note-num)
"Commit review session on git repository.
This function initializes the `gnosis-dir' as a Git repository if it is not
already one. It then adds the gnosis.db file to the repository and commits
the changes with a message containing the reviewed number of notes.
-NOTE-COUNT: The number of notes reviewed in the session to be commited."
+NOTE-NUM: The number of notes reviewed in the session."
(let ((git (executable-find "git"))
(default-directory gnosis-dir))
(unless git
(error "Git not found, please install git"))
(unless (file-exists-p (expand-file-name ".git" gnosis-dir))
- (vc-create-repo 'Git))
- ;; TODO: Redo this using vc.
+ (vc-git-create-repo))
(unless gnosis-testing
- (shell-command (format "%s %s %s" git "add" (shell-quote-argument "gnosis.db")))
- (shell-command (format "%s %s %s" git "commit -m"
- (shell-quote-argument
- (format "Reviewed %d notes." note-count)))))
+ (vc-git-command nil 0 nil "add" "gnosis.db")
+ (vc-git-command nil 0 nil "commit" "-m" (format "Total notes reviewed: %d" note-num)))
(when (and gnosis-vc-auto-push (not gnosis-testing))
(gnosis-vc-push))
- (message "Review session finished.")))
+ (message "Review session finished. %d notes reviewed." note-num)))
(defun gnosis-review-action--edit (success note note-count)
"Edit NOTE during review.