git: revert back

pull/2777/head
Tienson Qin 2021-09-06 11:23:31 +08:00
parent cd853b5864
commit 7273112a00
1 changed files with 2 additions and 17 deletions

View File

@ -29,8 +29,6 @@
(when-not (= (str id-property) (str block-id))
(editor/set-block-property! block-id "id" block-id)))))))
(def ignore-files (atom {}))
(defn handle-changed!
[type {:keys [dir path content stat] :as payload}]
(when dir
@ -56,24 +54,11 @@
;; ignore truncate
(not (string/blank? content))
(not= (string/trim content)
(string/trim (or (db/get-file repo path) "")))
(not (string/includes? path "logseq/pages-metadata.edn"))
(not= (get @ignore-files path) content))
(p/let [
;; save the previous content in Logseq first and commit it to avoid
;; any data-loss.
_ (swap! ignore-files assoc path db-content)
_ (file-handler/alter-file repo path db-content {:re-render-root? false
:reset? false
:skip-compare? true})
result (ipc/ipc "gitCommitAll" "")
_ (file-handler/alter-file repo path content {:re-render-root? true
(string/trim (or (db/get-file 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)
(js/setTimeout (fn []
(when (= db-content (get @ignore-files path))
(swap! ignore-files dissoc path))) 2000)
nil)
(contains? #{"add" "change" "unlink"} type)