我希望API可以获取git hash来找到精确版本。
谢谢。
(defn git-hash
"Shells out to git and returns hash of commits on this branch:
git rev-parse HEAD
Options:
:dir - dir to invoke this command from, by default current directory
:short? - shorten hash to 7 length characters"
[{:keys [dir short?] :or {dir "."} :as params}]
(assert-specs "git-hash" params
:dir ::specs/path
:short? ::specs/boolean)
(-> {:command-args (cond-> ["git" "rev-parse"]
short? (conj "--short")
:default (conj "HEAD"))
:dir (.getPath (resolve-path dir))
:out :capture}
process
:out
str/trim))
已关闭,备注:使用git-process自v0.6.5起: (api/git-process {:git-args "rev-parse --short HEAD"})