|
|
@@ -23,34 +23,33 @@
|
|
|
bugs on some OS
|
|
|
e.g. on macOS, it doesn't fire the file change event when renaming between
|
|
|
caps and non-caps"
|
|
|
- [repo conn file-page file-path]
|
|
|
+ [conn file-page file-path]
|
|
|
(when-let [current-file (page-exists-in-another-file @conn file-page file-path)]
|
|
|
- (let [db @conn]
|
|
|
- (when (not= file-path current-file)
|
|
|
- (cond
|
|
|
+ (when (not= file-path current-file)
|
|
|
+ (cond
|
|
|
;; TODO: handle case sensitive file system
|
|
|
- (= (common-util/path-normalize (string/lower-case current-file))
|
|
|
- (common-util/path-normalize (string/lower-case file-path)))
|
|
|
+ (= (common-util/path-normalize (string/lower-case current-file))
|
|
|
+ (common-util/path-normalize (string/lower-case file-path)))
|
|
|
;; case renamed
|
|
|
- (when-let [file (d/entity @conn [:file/path current-file])]
|
|
|
+ (when-let [file (d/entity @conn [:file/path current-file])]
|
|
|
;; (p/let [disk-content (fs/read-file "" current-file)]
|
|
|
;; (fs/backup-db-file! repo current-file (:file/content file) disk-content))
|
|
|
- (ldb/transact! conn [{:db/id (:db/id file)
|
|
|
- :file/path file-path}]))
|
|
|
+ (ldb/transact! conn [{:db/id (:db/id file)
|
|
|
+ :file/path file-path}]))
|
|
|
|
|
|
- :else
|
|
|
- nil
|
|
|
+ :else
|
|
|
+ nil
|
|
|
;; (let [error (t :file/validate-existing-file-error current-file file-path)]
|
|
|
;; (state/pub-event! [:notification/show
|
|
|
;; {:content error
|
|
|
;; :status :error
|
|
|
;; :clear? false}]))
|
|
|
- )))))
|
|
|
+ ))))
|
|
|
|
|
|
(defn- validate-and-get-blocks-to-delete
|
|
|
"An implementation for the delete-blocks-fn in graph-parser/parse-file"
|
|
|
- [repo conn file-page file-path retain-uuid-blocks]
|
|
|
- (validate-existing-file repo conn file-page file-path)
|
|
|
+ [conn file-page file-path retain-uuid-blocks]
|
|
|
+ (validate-existing-file conn file-page file-path)
|
|
|
(graph-parser/get-blocks-to-delete @conn file-page file-path retain-uuid-blocks))
|
|
|
|
|
|
(defn- reset-file!*
|
|
|
@@ -70,7 +69,7 @@
|
|
|
([repo conn file-path content {:keys [verbose _ctime _mtime] :as options}]
|
|
|
(let [config (worker-state/get-config repo)
|
|
|
options (merge (dissoc options :verbose)
|
|
|
- {:delete-blocks-fn (partial validate-and-get-blocks-to-delete repo conn)
|
|
|
+ {:delete-blocks-fn (partial validate-and-get-blocks-to-delete conn)
|
|
|
;; Options here should also be present in gp-cli/parse-graph
|
|
|
:extract-options (merge
|
|
|
{:user-config config
|