File tree Expand file tree Collapse file tree
src/main/clojure/clojure/tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11Changelog
22===========
33
4+ * next
5+ * Add new ` object-type ` api - takes rev, returns object type
46* 2.2.156 on Apr 7, 2021
57 * ` tags ` api should fetch to ensure all tags are returned
68* 2.2.152 on Apr 3, 2021
Original file line number Diff line number Diff line change 4747 [url rev]
4848 (first (resolve-all url [rev])))
4949
50+ (defn object-type
51+ " Takes a git url and rev, and returns the object type, one of :tag :tree
52+ :commit or :blob, or nil if not known or ambiguous."
53+ [url rev]
54+ (let [git-dir (impl/ensure-git-dir url)]
55+ (if-let [type (impl/git-type git-dir rev)]
56+ type
57+ (do
58+ (impl/git-fetch (jio/file git-dir))
59+ (impl/git-type git-dir rev)))))
60+
5061(defn procure
5162 " Procure a working tree at rev for the git url representing the library lib,
5263 returns the directory path. lib is a qualified symbol where the qualifier is a
Original file line number Diff line number Diff line change 102102 (when (zero? exit)
103103 (str/trimr out))))
104104
105+ (defn git-type
106+ [git-dir rev]
107+ (let [{:keys [exit out]} (run-git " --git-dir" git-dir " cat-file" " -t" rev)]
108+ (when (zero? exit)
109+ (keyword (str/trimr out)))))
110+
105111; ; git merge-base --is-ancestor <maybe-ancestor-commit> <descendant-commit>
106112(defn- ancestor?
107113 [git-dir x y]
You can’t perform that action at this time.
0 commit comments