mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
fix: save the previous content in Logseq first and commit it
to avoid overwritten when syncing with iCloud/Dropbox/syncthing.
This commit is contained in:
@@ -49,9 +49,17 @@
|
||||
(js/console.warn "Can't get file in the db: " path)
|
||||
|
||||
(and (= "change" type)
|
||||
(not= (string/trim content) (string/trim db-content)))
|
||||
(p/let [_ (file-handler/alter-file repo path content {:re-render-root? true
|
||||
:from-disk? true})]
|
||||
(not= (string/trim content) (string/trim db-content))
|
||||
(not (string/includes? path "logseq/pages-metadata.edn")))
|
||||
(p/let [
|
||||
;; save the previous content in Logseq first and commit it to avoid
|
||||
;; any data-loss.
|
||||
_ (file-handler/alter-file repo path db-content {:re-render-root? false
|
||||
:reset? false
|
||||
:skip-compare? true})
|
||||
_ (ipc/ipc "gitCommitAll" "Save the file from Logseq's database")
|
||||
_ (file-handler/alter-file repo path content {:re-render-root? true
|
||||
:skip-compare? true})]
|
||||
(set-missing-block-ids! content)
|
||||
(db/set-file-last-modified-at! repo path mtime))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user