Browse Source

fix: run git config core.safecrlf false on windows

Tienson Qin 4 năm trước cách đây
mục cha
commit
8dc0ca9ff5

+ 4 - 1
src/electron/electron/git.cljs

@@ -58,7 +58,9 @@
                ["init" (str "--separate-git-dir=" separate-git-dir)]
                :else
                ["init"])]
-    (-> (run-git! (clj->js args))
+    (-> (p/let [_ (run-git! (clj->js args))]
+          (when utils/win32?
+            (run-git! ["config" "core.safecrlf" "false"])))
         (p/catch (fn [error]
                    (when (string/starts-with? error "fatal: not a git repository")
                      (let [p (.join path (get-graph-path) ".git")]
@@ -148,6 +150,7 @@
   []
   (when (not (state/git-auto-commit-disabled?))
     (state/clear-git-commit-interval!)
+    (js/setTimeout add-all-and-commit! 3000)
     (let [seconds (state/get-git-commit-seconds)]
       (when (int? seconds)
         (let [interval (js/setInterval add-all-and-commit! (* seconds 1000))]

+ 4 - 2
src/main/frontend/fs/watcher_handler.cljs

@@ -53,12 +53,14 @@
                ;; ignore truncate
                (not (string/blank? content))
                (not= (string/trim content)
-                     (string/trim (or (db/get-file repo path) ""))))
+                     (string/trim (or (db/get-file repo path) "")))
+               (not (string/includes? path "logseq/pages-metadata.edn")))
           (p/let [db-content (or (db/get-file repo path) "")
                   ;; 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})
+                                                                   :reset? false
+                                                                   :skip-compare? true})
                   result (ipc/ipc "gitCommitAll" "")
                   _ (file-handler/alter-file repo path content {:re-render-root? true
                                                                 :from-disk? true})]