(fix)org-roam-db--file-hash: Always compute hash of encrypted file (#1725)

When inserting the GPG decrypted org buffer to to DB, make sure that
the hash of the encrypted file is stored.

This prevents reparsing of GPG files over and over again when
synchronizing the database with the filesystem.

Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
This commit is contained in:
Jürgen Hötzel
2021-08-09 09:13:45 +02:00
committed by GitHub
parent 39b2388768
commit f227c03672

View File

@@ -453,6 +453,10 @@ If UPDATE-P is non-nil, first remove the file in the database."
(defun org-roam-db--file-hash (&optional file-path)
"Compute the hash of FILE-PATH, a file or current buffer."
;; If it is a GPG encrypted file, we always want to compute the hash
;; for the GPG encrypted file (undecrypted)
(when (and (not file-path) (equal "gpg" (file-name-extension (buffer-file-name))))
(setq file-path (buffer-file-name)))
(if file-path
(with-temp-buffer
(set-buffer-multibyte nil)