Skip to content

Commit 1d9b478

Browse files
committed
Add commit-sha api function to return commit sha for rev
1 parent 9f98af7 commit 1d9b478

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Changelog
22
===========
33

4+
* next
5+
* Add `commit-sha` api function to return commit sha for rev
46
* 2.4.172 on Nov 8, 2021
57
* TDEPS-212 - Support local file repos
68
* 2.3.167 on Apr 22, 2021

src/main/clojure/clojure/tools/gitlibs.clj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,14 @@
8989
[url]
9090
(impl/tags (impl/ensure-git-dir url)))
9191

92+
(defn commit-sha
93+
"Returns unpeeled full commit sha, given a rev (which may be tag, branch, etc)"
94+
[url rev]
95+
(impl/git-rev-parse (impl/ensure-git-dir url) rev))
96+
9297
(comment
98+
(commit-sha "https://github.com/clojure/tools.build.git" "v0.8.2")
99+
93100
(System/setProperty "clojure.gitlibs.debug" "true")
94101
(resolve "[email protected]:clojure/tools.gitlibs.git" "11fc774")
95102
(descendant "https://github.com/clojure/tools.gitlibs.git" ["5e2797a487c" "11fc774" "d82adc29" "815e312310"])

0 commit comments

Comments
 (0)