Sfoglia il codice sorgente

feat: use HEAD as default hash in version selector

Liu Hancheng 2 anni fa
parent
commit
5f0ffa3055

+ 1 - 1
src/main/frontend/components/git.cljs

@@ -49,7 +49,7 @@
   [versions path get-content]
   (let
    [[content set-content!] (rum/use-state  nil)
-    [hash  set-hash!] (rum/use-state  nil)]
+    [hash  set-hash!] (rum/use-state   "HEAD")]
     (rum/use-effect! (fn [] (p/let [c (get-content hash path)] (set-content! c)) [hash path]))
     [:div.flex
      [:div.overflow-y-auto {:class "w-48 max-h-[calc(85vh_-_4rem)] "}

+ 0 - 10
src/main/frontend/handler/shell.cljs

@@ -2,7 +2,6 @@
   "Git related handler fns"
   (:require [clojure.string :as string]
             [electron.ipc :as ipc]
-            [frontend.config :as config]
             [frontend.db :as db]
             [frontend.handler.notification :as notification]
             [frontend.state :as state]
@@ -59,15 +58,6 @@
         :else
         (run-cli-command! command args)))))
 
-;; git show $REV:$FILE
-(defn- get-versioned-file-content
-  [hash path]
-  (when (and hash path)
-    (let [repo (state/get-current-repo)
-          local-dir (config/get-local-dir repo)
-          path (string/replace path (str local-dir "/") "")]
-      (p/let [content (run-git-command! ["show" (str hash ":" path)])]
-        (state/pub-event! [:modal/display-file-version path content hash])))))
 
 (defn get-file-latest-git-log
   [page n]