enhance: detect file changes when starting

This commit is contained in:
Tienson Qin
2021-09-07 21:13:25 +08:00
parent f7f270f599
commit d94ce5e78b
4 changed files with 17 additions and 12 deletions

View File

@@ -37,12 +37,13 @@
db-content (or (db/get-file repo path) "")]
(when (and content (not (encrypt/content-encrypted? content)))
(cond
(= "add" type)
(when-not (db/file-exists? repo path)
(p/let [_ (file-handler/alter-file repo path content {:re-render-root? true
:from-disk? true})]
(set-missing-block-ids! content)
(db/set-file-last-modified-at! repo path mtime)))
(and (= "add" type)
(not= (string/trim content) (string/trim db-content))
(not (string/includes? path "logseq/pages-metadata.edn")))
(p/let [_ (file-handler/alter-file repo path content {:re-render-root? true
:from-disk? true})]
(set-missing-block-ids! content)
(db/set-file-last-modified-at! repo path mtime))
(and (= "change" type)
(not (db/file-exists? repo path)))