feat: use HEAD as default hash in version selector

This commit is contained in:
Liu Hancheng
2023-11-30 15:09:47 +08:00
committed by Andelf
parent c94cf2f590
commit 5f0ffa3055
2 changed files with 1 additions and 11 deletions

View File

@@ -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)] "}

View File

@@ -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]