Skip to content

Commit

Permalink
detect features instead
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Sep 5, 2023
1 parent 56ae1c5 commit 6d7f2ea
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions pet.el
Original file line number Diff line number Diff line change
Expand Up @@ -436,29 +436,27 @@ project has hook ID set up."
"Parse `pre-commit' database.
Read the pre-commit SQLite database located at DB-FILE into an alist."
(if (or (< emacs-major-version 29)
(and (functionp 'sqlite-available-p)
(not (sqlite-available-p))))

(condition-case err
(with-temp-buffer
(call-process "sqlite3" nil t nil "-json" db-file "select * from repos")
(pet-parse-json (buffer-string)))
(error (pet-report-error err)))

(let ((db (sqlite-open db-file)))
(unwind-protect
(let* ((result-set (sqlite-select db "select * from repos" nil 'set))
result
row)
(while (setq row (sqlite-next result-set))
(setq result (cons (seq-mapn (lambda (a b) (cons (intern a) b))
(sqlite-columns result-set)
row)
result)))
(sqlite-finalize result-set)
result)
(sqlite-close db)))))
(if (and (functionp 'sqlite-available-p)
(sqlite-available-p))
(let ((db (sqlite-open db-file)))
(unwind-protect
(let* ((result-set (sqlite-select db "select * from repos" nil 'set))
result
row)
(while (setq row (sqlite-next result-set))
(setq result (cons (seq-mapn (lambda (a b) (cons (intern a) b))
(sqlite-columns result-set)
row)
result)))
(sqlite-finalize result-set)
result)
(sqlite-close db)))

(condition-case err
(with-temp-buffer
(call-process "sqlite3" nil t nil "-json" db-file "select * from repos")
(pet-parse-json (buffer-string)))
(error (pet-report-error err)))))

(defvar pet-pre-commit-database-cache nil)

Expand Down

0 comments on commit 6d7f2ea

Please sign in to comment.