Skip to content

Commit e6cd190

Browse files
committed
Fix NPE on tags if repo has no tags
1 parent 3af800e commit e6cd190

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

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+
* Fix NPE on tags if repo has no tags
46
* 2.6.212 on Dec 30, 2025
57
* Bump parent pom to latest
68
* 2.6.206 on Dec 5, 2024

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
(->> shas (sort (partial impl/commit-comparator git-dir)) first))))))
8686

8787
(defn tags
88-
"Fetches, then returns coll of tags in git url"
88+
"Fetches, then returns coll of tags in git url, nil if none"
8989
[url]
9090
(impl/tags (impl/ensure-git-dir url)))
9191

@@ -114,4 +114,8 @@
114114

115115
;; big output
116116
(tags "https://github.com/confluentinc/kafka-streams-examples.git")
117+
118+
;; no tags
119+
(tags "https://github.com/clojure/clojure-site.git")
120+
(clojure.repl/pst *e)
117121
)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,5 @@
206206
(let [{:keys [exit out err] :as ret} (run-git "--git-dir" git-dir "tag" "--sort=v:refname")]
207207
(when-not (zero? exit)
208208
(throw (ex-info (format "Unable to get tags %s%n%s" git-dir err) ret)))
209-
(remove str/blank? (str/split-lines out))))
209+
(when out
210+
(remove str/blank? (str/split-lines out)))))

0 commit comments

Comments
 (0)