Skip to content

Commit

Permalink
remove string-some-changed? function
Browse files Browse the repository at this point in the history
  • Loading branch information
llcc authored and tiensonqin committed Jun 30, 2022
1 parent 1497d12 commit f394f83
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/main/frontend/fs/capacitor_fs.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(ns frontend.fs.capacitor-fs
(:require ["@capacitor/filesystem" :refer [Encoding Filesystem]]
["diff" :as diff]
[cljs-bean.core :as bean]
[clojure.string :as string]
[frontend.config :as config]
Expand All @@ -10,7 +9,6 @@
[frontend.mobile.util :as mobile-util]
[frontend.state :as state]
[frontend.util :as util]
[goog.object :as gobj]
[lambdaisland.glogi :as log]
[promesa.core :as p]
[rum.core :as rum]))
Expand Down Expand Up @@ -137,12 +135,6 @@
:recursive true}))
(truncate-old-versioned-files! backup-dir)))

(defn string-some-changed?
[old new]
(let [result (-> ((gobj/get diff "diffChars") old new)
bean/->clj)]
(> (count result) 10)))

(defn- write-file-impl!
[_this repo _dir path content {:keys [ok-handler error-handler old-content skip-compare?]} stat]
(if skip-compare?
Expand Down Expand Up @@ -189,10 +181,7 @@
mtime (-> (js->clj stat :keywordize-keys true)
:mtime)]
(when-not contents-matched?
(when (and (string? disk-content)
(string? content)
(string-some-changed? disk-content content))
(backup-file repo-dir path disk-content ext)))
(backup-file repo-dir path disk-content ext))
(db/set-file-last-modified-at! repo path mtime)
(p/let [content (if (encrypt/encrypted-db? (state/get-current-repo))
(encrypt/decrypt content)
Expand Down

0 comments on commit f394f83

Please sign in to comment.