fix: detect "file modified" with file contents instead mtime

This commit is contained in:
Tienson Qin
2021-08-25 14:59:18 +08:00
parent 03bcf017fc
commit 2ed911ffcd
5 changed files with 32 additions and 35 deletions

View File

@@ -50,15 +50,16 @@
(js/console.warn "Can't get file in the db: " path)
(and (= "change" type)
(when-let [last-modified-at (db/get-file-last-modified-at repo path)]
(> mtime last-modified-at)))
(when-not (string/blank? content)
(p/let [result (ipc/ipc "gitCommitAll")
_ (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)
nil))
;; ignore truncate
(not (string/blank? content))
(not= (string/trim content)
(string/trim (or (db/get-file repo path) ""))))
(p/let [result (ipc/ipc "gitCommitAll")
_ (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)
nil)
(contains? #{"add" "change" "unlink"} type)
nil