From 69950ab75acd3cf0f637a8dab3705244d9cfc8b9 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 3 Mar 2021 14:21:10 -0600 Subject: [PATCH 001/105] bump version template --- VERSION_TEMPLATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION_TEMPLATE b/VERSION_TEMPLATE index a201147..677f189 100755 --- a/VERSION_TEMPLATE +++ b/VERSION_TEMPLATE @@ -1 +1 @@ -1.0.GENERATED_VERSION +2.0.GENERATED_VERSION From f765780f380febb970d712c5a8a51ce959842186 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Wed, 3 Mar 2021 14:27:56 -0600 Subject: [PATCH 002/105] [maven-release-plugin] prepare release tools.gitlibs-2.0.109 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9483784..2a8426b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 1.0.101-SNAPSHOT + 2.0.109 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + tools.gitlibs-2.0.109 From c52ee73d0758b51be820ca3034ad6969fa63889f Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Wed, 3 Mar 2021 14:27:56 -0600 Subject: [PATCH 003/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 2a8426b..d1fc279 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.0.109 + 2.0.110-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - tools.gitlibs-2.0.109 + HEAD From d9ba4f2bfa32e21eec74314b776297fbbed33d34 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Fri, 5 Mar 2021 09:40:53 -0600 Subject: [PATCH 004/105] add tags api --- src/main/clojure/clojure/tools/gitlibs.clj | 8 ++++++++ src/main/clojure/clojure/tools/gitlibs/impl.clj | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/src/main/clojure/clojure/tools/gitlibs.clj b/src/main/clojure/clojure/tools/gitlibs.clj index f8d9b03..9ff87c9 100644 --- a/src/main/clojure/clojure/tools/gitlibs.clj +++ b/src/main/clojure/clojure/tools/gitlibs.clj @@ -71,6 +71,13 @@ nil ;; can't resolve all shas in this repo (first (sort (partial impl/commit-comparator git-dir opts) shas))))))) +(defn tags + "Returns coll of tags in git url" + ([url] + (tags url nil)) + ([url opts] + (impl/tags (impl/ensure-git-dir url opts) opts))) + (comment (resolve "git@github.com:clojure/tools.gitlibs.git" "11fc774" {:print-commands true :interactive true}) (descendant "https://github.com/clojure/tools.gitlibs.git" ["5e2797a487c" "11fc774" "d82adc29" "815e312310"] {:print-commands true}) @@ -79,4 +86,5 @@ @(future (procure "https://github.com/clojure/tools.gitlibs.git" 'org.clojure/tools.gitlibs "11fc77496f013871c8af3514bbba03de0af28061")) @(future (procure "https://github.com/clojure/tools.gitlibs.git" 'org.clojure/tools.gitlibs "11fc77496f013871c8af3514bbba03de0af28061"))) + (tags "https://github.com/clojure/tools.gitlibs.git" {:print-commands true}) ) \ No newline at end of file diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index b98e9a7..3a509bc 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -148,3 +148,10 @@ 0 nil 1 (.getName ^File (aget matches 0)) (throw (IOException. (str "Prefix not unique: " prefix)))))))) + +(defn tags + [git-dir opts] + (let [{:keys [exit out err] :as ret} (runproc opts "git" "--git-dir" git-dir "tag")] + (when-not (zero? exit) + (throw (ex-info (format "Unable to get tags %s%n%s" git-dir err) ret))) + (remove str/blank? (str/split-lines out)))) \ No newline at end of file From c9bfd57a02f7f0b09b9512b823fda15c21bd1627 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Fri, 5 Mar 2021 09:43:10 -0600 Subject: [PATCH 005/105] check for reflection --- src/main/clojure/clojure/tools/gitlibs.clj | 2 ++ src/main/clojure/clojure/tools/gitlibs/impl.clj | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/clojure/clojure/tools/gitlibs.clj b/src/main/clojure/clojure/tools/gitlibs.clj index f8d9b03..9a8d9b6 100644 --- a/src/main/clojure/clojure/tools/gitlibs.clj +++ b/src/main/clojure/clojure/tools/gitlibs.clj @@ -16,6 +16,8 @@ [clojure.java.io :as jio] [clojure.tools.gitlibs.impl :as impl])) +(set! *warn-on-reflection* true) + (defn cache-dir "Return the root gitlibs cache directory. By default ~/.gitlibs or override by setting the environment variable GITLIBS." diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index b98e9a7..582c47c 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -14,6 +14,8 @@ (:import [java.io File FilenameFilter IOException])) +(set! *warn-on-reflection* true) + ;; io util (defn printerrln [& msgs] @@ -118,7 +120,7 @@ (condp = exit 0 true 1 false - (throw (ex-info (format "Unable to compare commits %s%n%s" (.getCanonicalPath git-dir) err) ret))))) + (throw (ex-info (format "Unable to compare commits %s%n%s" git-dir err) ret))))) (defn commit-comparator [git-dir opts x y] From c6ae8a8a046382bda4fe842386433f3d48757787 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Mon, 8 Mar 2021 13:19:51 -0600 Subject: [PATCH 006/105] clone if git dir empty --- src/main/clojure/clojure/tools/gitlibs/impl.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 582c47c..90a44a6 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -90,9 +90,9 @@ (defn ensure-git-dir "Ensure the bare git dir for the specified url, return the path to the git dir." [url opts] - (let [git-dir-file (git-dir url)] - (if (.exists git-dir-file) - (git-fetch git-dir-file opts) + (let [git-dir-file (git-dir url) + config-file (jio/file git-dir-file "config")] + (when-not (.exists config-file) (git-clone-bare url git-dir-file opts)) (.getCanonicalPath git-dir-file))) From 737f63129dfa4f6df13896cb8962cdb4b343561d Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Mon, 8 Mar 2021 13:21:33 -0600 Subject: [PATCH 007/105] fetch only when revs cannot be resolved --- src/main/clojure/clojure/tools/gitlibs.clj | 36 +++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/main/clojure/clojure/tools/gitlibs.clj b/src/main/clojure/clojure/tools/gitlibs.clj index 9a8d9b6..2fb0dff 100644 --- a/src/main/clojure/clojure/tools/gitlibs.clj +++ b/src/main/clojure/clojure/tools/gitlibs.clj @@ -24,9 +24,31 @@ [] (impl/cache-dir)) +;; Possible new API, internal for now +(defn- resolve-all + "Takes a git url and a coll of revs, and returns the full commit shas. + Each rev may be a partial sha, full sha, or tag name. Returns nil for + unresolveable revs. + + Optional opts map may include: + :interactive (default false) - set true to allow stdin prompts (example: unknown host) + :print-commands (default false) - set true to write git executions to stderr" + ([url revs] + (resolve-all url revs nil)) + ([url revs opts] + (let [git-dir (impl/ensure-git-dir url opts)] + (reduce + (fn [rs r] + (if-let [res (impl/git-rev-parse git-dir r opts)] + (conj rs res) + (do ;; could not resolve - fetch and try again + (impl/git-fetch (jio/file git-dir) opts) + (conj rs (impl/git-rev-parse git-dir r opts))))) + [] revs)))) + (defn resolve - "Takes a git url and a rev, and returns the full commit sha. rev may be a - partial sha, full sha, or tag name. + "Takes a git url and a rev, and returns the full commit sha or nil if can't + resolve. rev may be a partial sha, full sha, or tag name. Optional opts map may include: :interactive (default false) - set true to allow stdin prompts (example: unknown host) @@ -34,7 +56,7 @@ ([url rev] (resolve url rev nil)) ([url rev opts] - (impl/git-rev-parse (impl/ensure-git-dir url opts) rev opts))) + (first (resolve-all url [rev] opts)))) (defn procure "Procure a working tree at rev for the git url representing the library lib, @@ -67,11 +89,11 @@ (descendant url rev nil)) ([url revs opts] (when (seq revs) - (let [git-dir (impl/ensure-git-dir url opts) - shas (map #(impl/git-rev-parse git-dir % opts) revs)] - (if (not-empty (filter nil? shas)) + (let [shas (resolve-all url revs opts)] + (if (seq (filter nil? shas)) nil ;; can't resolve all shas in this repo - (first (sort (partial impl/commit-comparator git-dir opts) shas))))))) + (let [git-dir (impl/ensure-git-dir url opts)] + (->> shas (sort (partial impl/commit-comparator git-dir opts)) first))))))) (comment (resolve "git@github.com:clojure/tools.gitlibs.git" "11fc774" {:print-commands true :interactive true}) From 6225926cc076c423c7b1379614db0478ecd62474 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Tue, 9 Mar 2021 01:11:20 -0600 Subject: [PATCH 008/105] checkout to temp dir and move --- src/main/clojure/clojure/tools/gitlibs.clj | 3 +- .../clojure/clojure/tools/gitlibs/impl.clj | 56 ++++++++++++++++--- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/src/main/clojure/clojure/tools/gitlibs.clj b/src/main/clojure/clojure/tools/gitlibs.clj index 2fb0dff..b2a9a06 100644 --- a/src/main/clojure/clojure/tools/gitlibs.clj +++ b/src/main/clojure/clojure/tools/gitlibs.clj @@ -70,12 +70,13 @@ (procure url lib rev nil)) ([url lib rev opts] (let [lib-dir (impl/lib-dir lib) + git-dir-path (impl/ensure-git-dir url opts) sha (or (impl/match-exact lib-dir rev) (impl/match-prefix lib-dir rev) (resolve url rev))] (when sha (let [sha-dir (jio/file lib-dir sha)] (when-not (.exists sha-dir) (impl/printerrln "Checking out:" url "at" rev) - (impl/git-checkout url sha-dir sha opts)) + (impl/git-checkout git-dir-path lib-dir sha opts)) (.getCanonicalPath sha-dir)))))) (defn descendant diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 90a44a6..e7d1bbe 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -12,7 +12,9 @@ [clojure.java.io :as jio] [clojure.string :as str]) (:import - [java.io File FilenameFilter IOException])) + [java.io File FilenameFilter IOException] + [java.nio.file Files CopyOption StandardCopyOption AtomicMoveNotSupportedException] + [java.nio.file.attribute FileAttribute])) (set! *warn-on-reflection* true) @@ -96,15 +98,51 @@ (git-clone-bare url git-dir-file opts)) (.getCanonicalPath git-dir-file))) +(defonce ^:private no-file-attrs + (time (into-array FileAttribute []))) + +(defonce ^:private no-copy-opts + (into-array CopyOption [])) + +(defonce ^:private atomic-move-opts + (into-array CopyOption [StandardCopyOption/ATOMIC_MOVE])) + +(defn- delete-recursive + [^File file] + (when (.isDirectory file) + (run! delete-recursive (.listFiles file))) + (.delete file)) + +(defn- write-with-temp + [^File parent-dir target write-fn] + (let [target-dir (jio/file parent-dir target)] + (when-not (.exists target-dir) + (when-not (.exists parent-dir) + (.mkdirs parent-dir)) + (let [parent-path (.toPath parent-dir) + temp-path (Files/createTempDirectory parent-path (str target "-") no-file-attrs)] + (write-fn (.toString temp-path)) + (let [target-path (.toPath target-dir)] + (try + (try + (Files/move temp-path target-path atomic-move-opts) + (catch AtomicMoveNotSupportedException _ + (Files/move temp-path target-path no-copy-opts))) + (catch IOException _ + (try + (delete-recursive (.toFile temp-path)) + (catch Throwable t))))))))) + (defn git-checkout - [url ^File rev-dir ^String rev opts] - (when-not (.exists rev-dir) - (.mkdirs rev-dir)) - (runproc opts - "git" - "--git-dir" (ensure-git-dir url opts) - "--work-tree" (.getCanonicalPath rev-dir) - "checkout" rev)) + [git-dir-path ^File lib-dir ^String rev opts] + (let [rev-file (jio/file lib-dir rev)] + (when-not (.exists rev-file) + (write-with-temp lib-dir rev + #(runproc opts + "git" + "--git-dir" git-dir-path + "--work-tree" % + "checkout" rev))))) (defn git-rev-parse [git-dir rev opts] From cfbd7b43aa2d3623d74c391ea9e24dde861f45c9 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Tue, 9 Mar 2021 15:21:33 -0600 Subject: [PATCH 009/105] expand config for git dir and git command --- .../clojure/clojure/tools/gitlibs/impl.clj | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index e7d1bbe..e066d4e 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -36,21 +36,42 @@ err (slurp (.getErrorStream proc))] {:exit exit :out out :err err})) +;; config + +(defn- read-config + "Read a config value from each of these in order, taking the first value found: + * Java system property + * env variable + * default value" + [property env default] + (or + (System/getProperty property) + (System/getenv env) + default)) + ;; dirs (def ^:private CACHE (delay (.getCanonicalPath - (let [env (System/getenv "GITLIBS")] - (if (str/blank? env) + (let [lib-dir (read-config "clojure.gitlibs.dir" "GITLIBS" nil)] + (if (str/blank? lib-dir) (jio/file (System/getProperty "user.home") ".gitlibs") - (jio/file env)))))) + (jio/file lib-dir)))))) (defn cache-dir "Absolute path to the root of the cache" [] @CACHE) +(def ^:private COMMAND_CACHE + (delay (read-config "clojure.gitlibs.command" "GITLIBS_CMD" "git"))) + +(defn git-command + "Path to git command to run" + [] + @COMMAND_CACHE) + (defn lib-dir ^File [lib] (jio/file (cache-dir) "libs" (namespace lib) (name lib))) @@ -75,7 +96,7 @@ (defn git-fetch [^File git-dir opts] (let [git-path (.getCanonicalPath git-dir) - {:keys [exit err] :as ret} (runproc opts "git" "--git-dir" git-path "fetch" "--tags")] + {:keys [exit err] :as ret} (runproc opts (git-command) "--git-dir" git-path "fetch" "--tags")] (when-not (zero? exit) (throw (ex-info (format "Unable to fetch %s%n%s" git-path err) ret))))) @@ -84,7 +105,7 @@ [url ^File git-dir opts] (printerrln "Cloning:" url) (let [git-path (.getCanonicalPath git-dir) - {:keys [exit err] :as ret} (runproc opts "git" "clone" "--bare" url git-path)] + {:keys [exit err] :as ret} (runproc opts (git-command) "clone" "--bare" url git-path)] (when-not (zero? exit) (throw (ex-info (format "Unable to clone %s%n%s" git-path err) ret))) git-dir)) @@ -99,7 +120,7 @@ (.getCanonicalPath git-dir-file))) (defonce ^:private no-file-attrs - (time (into-array FileAttribute []))) + (into-array FileAttribute [])) (defonce ^:private no-copy-opts (into-array CopyOption [])) @@ -139,21 +160,21 @@ (when-not (.exists rev-file) (write-with-temp lib-dir rev #(runproc opts - "git" + (git-command) "--git-dir" git-dir-path "--work-tree" % "checkout" rev))))) (defn git-rev-parse [git-dir rev opts] - (let [{:keys [exit out]} (runproc opts "git" "--git-dir" git-dir "rev-parse" rev)] + (let [{:keys [exit out]} (runproc opts (git-command) "--git-dir" git-dir "rev-parse" rev)] (when (zero? exit) (str/trimr out)))) ;; git merge-base --is-ancestor (defn- ancestor? [git-dir x y opts] - (let [args ["git" "--git-dir" git-dir "merge-base" "--is-ancestor" x y] + (let [args [(git-command) "--git-dir" git-dir "merge-base" "--is-ancestor" x y] {:keys [exit err] :as ret} (apply runproc opts args)] (condp = exit 0 true From 922617277f23a8196d8da68f82b8a8170ee83580 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 00:14:18 -0600 Subject: [PATCH 010/105] switch to using git worktree instead of checkout --- src/main/clojure/clojure/tools/gitlibs.clj | 5 ++ .../clojure/clojure/tools/gitlibs/impl.clj | 64 ++++--------------- .../clojure/clojure/tools/test_gitlibs.clj | 8 ++- 3 files changed, 23 insertions(+), 54 deletions(-) diff --git a/src/main/clojure/clojure/tools/gitlibs.clj b/src/main/clojure/clojure/tools/gitlibs.clj index b2a9a06..3a341bb 100644 --- a/src/main/clojure/clojure/tools/gitlibs.clj +++ b/src/main/clojure/clojure/tools/gitlibs.clj @@ -104,4 +104,9 @@ @(future (procure "https://github.com/clojure/tools.gitlibs.git" 'org.clojure/tools.gitlibs "11fc77496f013871c8af3514bbba03de0af28061")) @(future (procure "https://github.com/clojure/tools.gitlibs.git" 'org.clojure/tools.gitlibs "11fc77496f013871c8af3514bbba03de0af28061"))) + (println + @(future (procure "https://github.com/cognitect-labs/test-runner.git" 'cognitect-labs/test-runner "b6b3193fcc42659d7e46ecd1884a228993441182")) + @(future (procure "https://github.com/cognitect-labs/test-runner.git" 'cognitect-labs/test-runner "cb96e80f6f3d3b307c59cbeb49bb0dcb3a2a780b")) + @(future (procure "https://github.com/cognitect-labs/test-runner.git" 'cognitect-labs/test-runner "9e1098965f2089c8cf492d23c0b7520f8690440a"))) + ) \ No newline at end of file diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index e066d4e..ba81a15 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -12,9 +12,7 @@ [clojure.java.io :as jio] [clojure.string :as str]) (:import - [java.io File FilenameFilter IOException] - [java.nio.file Files CopyOption StandardCopyOption AtomicMoveNotSupportedException] - [java.nio.file.attribute FileAttribute])) + [java.io File FilenameFilter IOException])) (set! *warn-on-reflection* true) @@ -89,14 +87,12 @@ ^File [url] (jio/file (cache-dir) "_repos" (clean-url url))) -;; git clone --bare --quiet URL PATH -;; git --git-dir <> fetch -;; git --git-dir <> --work-tree checkout - (defn git-fetch [^File git-dir opts] (let [git-path (.getCanonicalPath git-dir) - {:keys [exit err] :as ret} (runproc opts (git-command) "--git-dir" git-path "fetch" "--tags")] + {:keys [exit err] :as ret} (runproc opts (git-command) + "--git-dir" git-path + "fetch" "--quiet" "--tags")] (when-not (zero? exit) (throw (ex-info (format "Unable to fetch %s%n%s" git-path err) ret))))) @@ -105,7 +101,8 @@ [url ^File git-dir opts] (printerrln "Cloning:" url) (let [git-path (.getCanonicalPath git-dir) - {:keys [exit err] :as ret} (runproc opts (git-command) "clone" "--bare" url git-path)] + {:keys [exit err] :as ret} (runproc opts (git-command) + "clone" "--quiet" "--bare" url git-path)] (when-not (zero? exit) (throw (ex-info (format "Unable to clone %s%n%s" git-path err) ret))) git-dir)) @@ -119,55 +116,20 @@ (git-clone-bare url git-dir-file opts)) (.getCanonicalPath git-dir-file))) -(defonce ^:private no-file-attrs - (into-array FileAttribute [])) - -(defonce ^:private no-copy-opts - (into-array CopyOption [])) - -(defonce ^:private atomic-move-opts - (into-array CopyOption [StandardCopyOption/ATOMIC_MOVE])) - -(defn- delete-recursive - [^File file] - (when (.isDirectory file) - (run! delete-recursive (.listFiles file))) - (.delete file)) - -(defn- write-with-temp - [^File parent-dir target write-fn] - (let [target-dir (jio/file parent-dir target)] - (when-not (.exists target-dir) - (when-not (.exists parent-dir) - (.mkdirs parent-dir)) - (let [parent-path (.toPath parent-dir) - temp-path (Files/createTempDirectory parent-path (str target "-") no-file-attrs)] - (write-fn (.toString temp-path)) - (let [target-path (.toPath target-dir)] - (try - (try - (Files/move temp-path target-path atomic-move-opts) - (catch AtomicMoveNotSupportedException _ - (Files/move temp-path target-path no-copy-opts))) - (catch IOException _ - (try - (delete-recursive (.toFile temp-path)) - (catch Throwable t))))))))) - (defn git-checkout [git-dir-path ^File lib-dir ^String rev opts] (let [rev-file (jio/file lib-dir rev)] (when-not (.exists rev-file) - (write-with-temp lib-dir rev - #(runproc opts - (git-command) - "--git-dir" git-dir-path - "--work-tree" % - "checkout" rev))))) + (runproc opts (git-command) + "--git-dir" git-dir-path + "worktree" "add" "--force" "--detach" "--quiet" + (.getCanonicalPath rev-file) rev)))) (defn git-rev-parse [git-dir rev opts] - (let [{:keys [exit out]} (runproc opts (git-command) "--git-dir" git-dir "rev-parse" rev)] + (let [{:keys [exit out]} (runproc opts (git-command) + "--git-dir" git-dir + "rev-parse" rev)] (when (zero? exit) (str/trimr out)))) diff --git a/src/test/clojure/clojure/tools/test_gitlibs.clj b/src/test/clojure/clojure/tools/test_gitlibs.clj index c14e9bc..d1e1d84 100644 --- a/src/test/clojure/clojure/tools/test_gitlibs.clj +++ b/src/test/clojure/clojure/tools/test_gitlibs.clj @@ -20,9 +20,11 @@ "739c1af56dae621aedf1bb282025a0d676eff713"))) (deftest test-procure - (let [wt (gl/procure repo-url 'org.clojure/spec.alpha "739c1af")] - (is (= wt (.getAbsolutePath (jio/file (glim/cache-dir) "libs" "org.clojure" "spec.alpha" "739c1af56dae621aedf1bb282025a0d676eff713")))) - (is (.exists (jio/file (glim/cache-dir) "_repos" "github.com" "clojure" "spec.alpha"))))) + (let [wt1 (gl/procure repo-url 'org.clojure/spec.alpha "739c1af") + wt2 (gl/procure repo-url 'org.clojure/spec.alpha "6a56327")] + (is (.exists (jio/file (glim/cache-dir) "_repos" "github.com" "clojure" "spec.alpha"))) + (is (= wt1 (.getAbsolutePath (jio/file (glim/cache-dir) "libs" "org.clojure" "spec.alpha" "739c1af56dae621aedf1bb282025a0d676eff713")))) + (is (= wt2 (.getAbsolutePath (jio/file (glim/cache-dir) "libs" "org.clojure" "spec.alpha" "6a56327446c909db0d11ecf93a3c3d659b739be9")))))) (deftest test-descendant-fixed (is (= (gl/descendant repo-url ["607aef0" "739c1af"]) From f18bf582f858bd094e7e9cfd38b17f64251d0c6c Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 00:19:59 -0600 Subject: [PATCH 011/105] make env var match java system property --- src/main/clojure/clojure/tools/gitlibs/impl.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index ba81a15..fe1367e 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -63,7 +63,7 @@ @CACHE) (def ^:private COMMAND_CACHE - (delay (read-config "clojure.gitlibs.command" "GITLIBS_CMD" "git"))) + (delay (read-config "clojure.gitlibs.command" "GITLIBS_COMMAND" "git"))) (defn git-command "Path to git command to run" From dbe4bacdf8d86f8e23b1e3df6fb1e85299f1ca40 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 00:20:44 -0600 Subject: [PATCH 012/105] update changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ec6377..bd6de94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog =========== +* next + * Fix issues with checkouts of multiple commits per repo + * resolve now only fetches if it can't resolve a ref + * Config read from most to least preferred: Java system property / env var / default: + * gitlibs dir: clojure.gitlibs.dir / GITLIBS / nil + * git command: clojure.gitlibs.command / GITLIBS_COMMAND / "git" + * Fix reflection error * 1.0.100 on Aug 20, 2020 * Fetch all tags on procure * 1.0.96 on Aug 7, 2020 From e196038030fe5b4894aa07698d580d642933a133 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Wed, 10 Mar 2021 00:27:50 -0600 Subject: [PATCH 013/105] [maven-release-plugin] prepare release tools.gitlibs-2.0.119 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d1fc279..44f07c7 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.0.110-SNAPSHOT + 2.0.119 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + tools.gitlibs-2.0.119 From e4108eaf84cc3b9c0cbef0148d31bdd11e05c927 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Wed, 10 Mar 2021 00:27:51 -0600 Subject: [PATCH 014/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 44f07c7..27a54b0 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.0.119 + 2.0.120-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - tools.gitlibs-2.0.119 + HEAD From 3e1ccd264daada58014584111886eee9d089f1d4 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 00:36:48 -0600 Subject: [PATCH 015/105] update for release --- CHANGELOG.md | 8 +++++--- README.md | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd6de94..28cb909 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,15 @@ Changelog =========== -* next +* 2.0.119 on Mar 10, 2021 * Fix issues with checkouts of multiple commits per repo * resolve now only fetches if it can't resolve a ref * Config read from most to least preferred: Java system property / env var / default: - * gitlibs dir: clojure.gitlibs.dir / GITLIBS / nil - * git command: clojure.gitlibs.command / GITLIBS_COMMAND / "git" + * gitlibs dir: `clojure.gitlibs.dir` / `GITLIBS` / `nil` + * git command: `clojure.gitlibs.command` / `GITLIBS_COMMAND` / `"git"` * Fix reflection error +* 2.0.109 on Mar 3, 2021 + * TDEPS-91 Replace jgit implementation by shelling out to git * 1.0.100 on Aug 20, 2020 * Fetch all tags on procure * 1.0.96 on Aug 7, 2020 diff --git a/README.md b/README.md index de4704a..d9a89d4 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ The following git url types are supported: ### SSH authentication for private repositories -ssh authentication works by connecting to the local ssh agent (ssh-agent on *nix or Pageant via PuTTY on Windows). +ssh authentication works by connecting to the local ssh agent (ssh-agent on \*nix or Pageant via PuTTY on Windows). The ssh-agent must have a registered identity for the key being used to access the Git repository. To check whether you have registered identities, use: @@ -83,10 +83,10 @@ The cache location can also be set with the environment variable GITLIBS. This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 1.0.100 +Latest release: 2.0.119 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "1.0.100"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.0.119"}` # Developer Information @@ -99,7 +99,7 @@ Latest release: 1.0.100 # Copyright and License -Copyright © 2018-2020 Rich Hickey, Alex Miller, and contributors +Copyright © 2018-2021 Rich Hickey, Alex Miller, and contributors All rights reserved. The use and distribution terms for this software are covered by the From d14ba73db7cf1541404c4a9254db28ccc6ddafe1 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 09:17:53 -0600 Subject: [PATCH 016/105] remove use of relatively recent git version to increase compatibility --- src/main/clojure/clojure/tools/gitlibs/impl.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index fe1367e..54eae64 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -122,7 +122,7 @@ (when-not (.exists rev-file) (runproc opts (git-command) "--git-dir" git-dir-path - "worktree" "add" "--force" "--detach" "--quiet" + "worktree" "add" "--force" "--detach" (.getCanonicalPath rev-file) rev)))) (defn git-rev-parse From cc0bdef00e31d15973582c376f396e9ae2cc7cd8 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 09:18:39 -0600 Subject: [PATCH 017/105] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28cb909..34dc79a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * Change git options during checkout to work with more git versions * 2.0.119 on Mar 10, 2021 * Fix issues with checkouts of multiple commits per repo * resolve now only fetches if it can't resolve a ref From 6f58f5aef63ce3425240819c29c32aa1d114c4cd Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 11:53:48 -0600 Subject: [PATCH 018/105] require Clojure 1.9 as dep --- deps.edn | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deps.edn b/deps.edn index 9341351..eff4f54 100644 --- a/deps.edn +++ b/deps.edn @@ -1,2 +1,2 @@ {:paths ["src/main/clojure"] - :deps {org.clojure/clojure {:mvn/version "1.8.0"}}} + :deps {org.clojure/clojure {:mvn/version "1.9.0"}}} diff --git a/pom.xml b/pom.xml index 27a54b0..d4dbb7e 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ true - 1.8.0 + 1.9.0 From 5703d1198621738265959bdc2107c78861b4ef52 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 12:15:04 -0600 Subject: [PATCH 019/105] overhaul config and debug, check for and report errors during checkout --- src/main/clojure/clojure/tools/gitlibs.clj | 98 ++++++---------- .../clojure/clojure/tools/gitlibs/config.clj | 48 ++++++++ .../clojure/clojure/tools/gitlibs/impl.clj | 110 +++++++----------- .../clojure/clojure/tools/test_gitlibs.clj | 9 +- 4 files changed, 129 insertions(+), 136 deletions(-) create mode 100644 src/main/clojure/clojure/tools/gitlibs/config.clj diff --git a/src/main/clojure/clojure/tools/gitlibs.clj b/src/main/clojure/clojure/tools/gitlibs.clj index 3a341bb..383b683 100644 --- a/src/main/clojure/clojure/tools/gitlibs.clj +++ b/src/main/clojure/clojure/tools/gitlibs.clj @@ -14,6 +14,7 @@ (:refer-clojure :exclude [resolve]) (:require [clojure.java.io :as jio] + [clojure.tools.gitlibs.config :as config] [clojure.tools.gitlibs.impl :as impl])) (set! *warn-on-reflection* true) @@ -22,83 +23,60 @@ "Return the root gitlibs cache directory. By default ~/.gitlibs or override by setting the environment variable GITLIBS." [] - (impl/cache-dir)) + (:gitlibs/dir @config/CONFIG)) ;; Possible new API, internal for now (defn- resolve-all "Takes a git url and a coll of revs, and returns the full commit shas. Each rev may be a partial sha, full sha, or tag name. Returns nil for - unresolveable revs. - - Optional opts map may include: - :interactive (default false) - set true to allow stdin prompts (example: unknown host) - :print-commands (default false) - set true to write git executions to stderr" - ([url revs] - (resolve-all url revs nil)) - ([url revs opts] - (let [git-dir (impl/ensure-git-dir url opts)] - (reduce - (fn [rs r] - (if-let [res (impl/git-rev-parse git-dir r opts)] - (conj rs res) - (do ;; could not resolve - fetch and try again - (impl/git-fetch (jio/file git-dir) opts) - (conj rs (impl/git-rev-parse git-dir r opts))))) - [] revs)))) + unresolveable revs." + [url revs] + (let [git-dir (impl/ensure-git-dir url)] + (reduce + (fn [rs r] + (if-let [res (impl/git-rev-parse git-dir r)] + (conj rs res) + (do ;; could not resolve - fetch and try again + (impl/git-fetch (jio/file git-dir)) + (conj rs (impl/git-rev-parse git-dir r))))) + [] revs))) (defn resolve "Takes a git url and a rev, and returns the full commit sha or nil if can't - resolve. rev may be a partial sha, full sha, or tag name. - - Optional opts map may include: - :interactive (default false) - set true to allow stdin prompts (example: unknown host) - :print-commands (default false) - set true to write git executions to stderr" - ([url rev] - (resolve url rev nil)) - ([url rev opts] - (first (resolve-all url [rev] opts)))) + resolve. rev may be a partial sha, full sha, or tag name." + [url rev] + (first (resolve-all url [rev]))) (defn procure "Procure a working tree at rev for the git url representing the library lib, returns the directory path. lib is a qualified symbol where the qualifier is a - controlled or conveyed identity, or nil if rev is unknown. - - Optional opts map may include: - :interactive (default false) - set true to allow stdin prompts (example: unknown host) - :print-commands (default false) - set true to write git commands to stderr" - ([url lib rev] - (procure url lib rev nil)) - ([url lib rev opts] - (let [lib-dir (impl/lib-dir lib) - git-dir-path (impl/ensure-git-dir url opts) - sha (or (impl/match-exact lib-dir rev) (impl/match-prefix lib-dir rev) (resolve url rev))] - (when sha - (let [sha-dir (jio/file lib-dir sha)] - (when-not (.exists sha-dir) - (impl/printerrln "Checking out:" url "at" rev) - (impl/git-checkout git-dir-path lib-dir sha opts)) - (.getCanonicalPath sha-dir)))))) + controlled or conveyed identity, or nil if rev is unknown." + [url lib rev] + (let [lib-dir (impl/lib-dir lib) + git-dir-path (impl/ensure-git-dir url) + sha (or (impl/match-exact lib-dir rev) (impl/match-prefix lib-dir rev) (resolve url rev))] + (when sha + (let [sha-dir (jio/file lib-dir sha)] + (when-not (.exists sha-dir) + (impl/printerrln "Checking out:" url "at" rev) + (impl/git-checkout git-dir-path lib-dir sha)) + (.getCanonicalPath sha-dir))))) (defn descendant "Returns rev in git url which is a descendant of all other revs, - or nil if no such relationship can be established. - - Optional opts map may include: - :interactive (default false) - set true to allow stdin prompts (example: unknown host) - :print-commands (default false) - set true to write git commands to stderr" - ([url rev] - (descendant url rev nil)) - ([url revs opts] - (when (seq revs) - (let [shas (resolve-all url revs opts)] - (if (seq (filter nil? shas)) - nil ;; can't resolve all shas in this repo - (let [git-dir (impl/ensure-git-dir url opts)] - (->> shas (sort (partial impl/commit-comparator git-dir opts)) first))))))) + or nil if no such relationship can be established." + [url revs] + (when (seq revs) + (let [shas (resolve-all url revs)] + (if (seq (filter nil? shas)) + nil ;; can't resolve all shas in this repo + (let [git-dir (impl/ensure-git-dir url)] + (->> shas (sort (partial impl/commit-comparator git-dir)) first)))))) (comment - (resolve "git@github.com:clojure/tools.gitlibs.git" "11fc774" {:print-commands true :interactive true}) - (descendant "https://github.com/clojure/tools.gitlibs.git" ["5e2797a487c" "11fc774" "d82adc29" "815e312310"] {:print-commands true}) + (System/setProperty "clojure.gitlibs.debug" "true") + (resolve "git@github.com:clojure/tools.gitlibs.git" "11fc774") + (descendant "https://github.com/clojure/tools.gitlibs.git" ["5e2797a487c" "11fc774" "d82adc29" "815e312310"]) (println @(future (procure "https://github.com/clojure/tools.gitlibs.git" 'org.clojure/tools.gitlibs "11fc77496f013871c8af3514bbba03de0af28061")) diff --git a/src/main/clojure/clojure/tools/gitlibs/config.clj b/src/main/clojure/clojure/tools/gitlibs/config.clj new file mode 100644 index 0000000..ab9d8ac --- /dev/null +++ b/src/main/clojure/clojure/tools/gitlibs/config.clj @@ -0,0 +1,48 @@ +; Copyright (c) Rich Hickey. All rights reserved. +; The use and distribution terms for this software are covered by the +; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) +; which can be found in the file epl-v10.html at the root of this distribution. +; By using this software in any fashion, you are agreeing to be bound by +; the terms of this license. +; You must not remove this notice, or any other, from this software. + +(ns clojure.tools.gitlibs.config + "Implementation, use at your own risk" + (:require + [clojure.java.io :as jio] + [clojure.string :as str])) + +(set! *warn-on-reflection* true) + +(defn- read-config-value + "Read a config value from each of these in order, taking the first value found: + * Java system property + * env variable + * default value" + [property env default] + (or + (System/getProperty property) + (System/getenv env) + default)) + +(defn- init-config + [] + {:gitlibs/dir + (.getCanonicalPath + (let [lib-dir (or (System/getProperty "clojure.gitlibs.dir") (System/getenv "GITLIBS"))] + (if (str/blank? lib-dir) + (jio/file (System/getProperty "user.home") ".gitlibs") + (jio/file lib-dir)))) + + :gitlibs/command + (or (System/getProperty "clojure.gitlibs.command") (System/getenv "GITLIBS_COMMAND") "git") + + :gitlibs/debug + (Boolean/parseBoolean (or (System/getProperty "clojure.gitlibs.debug") (System/getenv "GITLIBS_DEBUG") "false")) + + :gitlibs/terminal + (Boolean/parseBoolean (or (System/getProperty "clojure.gitlibs.terminal") (System/getenv "GITLIBS_TERMINAL") "false"))}) + +(def CONFIG + "Config map - deref to access" + (delay (init-config))) \ No newline at end of file diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 54eae64..3e71bc4 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -10,8 +10,10 @@ "Implementation, use at your own risk" (:require [clojure.java.io :as jio] - [clojure.string :as str]) + [clojure.string :as str] + [clojure.tools.gitlibs.config :as config]) (:import + [java.lang ProcessBuilder$Redirect] [java.io File FilenameFilter IOException])) (set! *warn-on-reflection* true) @@ -22,57 +24,26 @@ (binding [*out* *err*] (apply println msgs))) -(defn- runproc - [{:keys [interactive print-commands]} & args] - (when print-commands - (apply printerrln args)) - (let [proc-builder (ProcessBuilder. ^java.util.List args) - _ (when-not interactive (.put (.environment proc-builder) "GIT_TERMINAL_PROMPT" "0")) - proc (.start proc-builder) - exit (.waitFor proc) - out (slurp (.getInputStream proc)) - err (slurp (.getErrorStream proc))] - {:exit exit :out out :err err})) - -;; config - -(defn- read-config - "Read a config value from each of these in order, taking the first value found: - * Java system property - * env variable - * default value" - [property env default] - (or - (System/getProperty property) - (System/getenv env) - default)) +(defn- run-git + [& args] + (let [{:gitlibs/keys [command debug terminal]} @config/CONFIG + command-args (cons command args)] + (when debug + (apply printerrln command-args)) + (let [proc-builder (ProcessBuilder. ^java.util.List command-args) + _ (when debug (.redirectError proc-builder ProcessBuilder$Redirect/INHERIT)) + _ (when-not terminal (.put (.environment proc-builder) "GIT_TERMINAL_PROMPT" "0")) + proc (.start proc-builder) + exit (.waitFor proc) + out (slurp (.getInputStream proc)) + err (slurp (.getErrorStream proc))] ;; if debug is true, stderr will be redirected instead + {:args command-args, :exit exit, :out out, :err err}))) ;; dirs -(def ^:private CACHE - (delay - (.getCanonicalPath - (let [lib-dir (read-config "clojure.gitlibs.dir" "GITLIBS" nil)] - (if (str/blank? lib-dir) - (jio/file (System/getProperty "user.home") ".gitlibs") - (jio/file lib-dir)))))) - -(defn cache-dir - "Absolute path to the root of the cache" - [] - @CACHE) - -(def ^:private COMMAND_CACHE - (delay (read-config "clojure.gitlibs.command" "GITLIBS_COMMAND" "git"))) - -(defn git-command - "Path to git command to run" - [] - @COMMAND_CACHE) - (defn lib-dir ^File [lib] - (jio/file (cache-dir) "libs" (namespace lib) (name lib))) + (jio/file (:gitlibs/dir @config/CONFIG) "libs" (namespace lib) (name lib))) (defn- clean-url "Chop leading protocol, trailing .git, replace :'s with /" @@ -85,70 +56,67 @@ (defn git-dir ^File [url] - (jio/file (cache-dir) "_repos" (clean-url url))) + (jio/file (:gitlibs/dir @config/CONFIG) "_repos" (clean-url url))) (defn git-fetch - [^File git-dir opts] + [^File git-dir] (let [git-path (.getCanonicalPath git-dir) - {:keys [exit err] :as ret} (runproc opts (git-command) - "--git-dir" git-path + {:keys [exit err] :as ret} (run-git "--git-dir" git-path "fetch" "--quiet" "--tags")] (when-not (zero? exit) (throw (ex-info (format "Unable to fetch %s%n%s" git-path err) ret))))) ;; TODO: restrict clone to an optional refspec? (defn git-clone-bare - [url ^File git-dir opts] + [url ^File git-dir] (printerrln "Cloning:" url) (let [git-path (.getCanonicalPath git-dir) - {:keys [exit err] :as ret} (runproc opts (git-command) - "clone" "--quiet" "--bare" url git-path)] + {:keys [exit err] :as ret} (run-git "clone" "--quiet" "--bare" url git-path)] (when-not (zero? exit) (throw (ex-info (format "Unable to clone %s%n%s" git-path err) ret))) git-dir)) (defn ensure-git-dir "Ensure the bare git dir for the specified url, return the path to the git dir." - [url opts] + [url] (let [git-dir-file (git-dir url) config-file (jio/file git-dir-file "config")] (when-not (.exists config-file) - (git-clone-bare url git-dir-file opts)) + (git-clone-bare url git-dir-file)) (.getCanonicalPath git-dir-file))) (defn git-checkout - [git-dir-path ^File lib-dir ^String rev opts] + [git-dir-path ^File lib-dir ^String rev] (let [rev-file (jio/file lib-dir rev)] (when-not (.exists rev-file) - (runproc opts (git-command) - "--git-dir" git-dir-path - "worktree" "add" "--force" "--detach" - (.getCanonicalPath rev-file) rev)))) + (let [{:keys [exit err] :as ret} + (run-git "--git-dir" git-dir-path + "worktree" "add" "--force" "--detach" + (.getCanonicalPath rev-file) rev)] + (when-not (zero? exit) + (throw (ex-info (format "Unable to checkout %s%n%s" rev err) ret))))))) (defn git-rev-parse - [git-dir rev opts] - (let [{:keys [exit out]} (runproc opts (git-command) - "--git-dir" git-dir - "rev-parse" rev)] + [git-dir rev] + (let [{:keys [exit out]} (run-git "--git-dir" git-dir "rev-parse" rev)] (when (zero? exit) (str/trimr out)))) ;; git merge-base --is-ancestor (defn- ancestor? - [git-dir x y opts] - (let [args [(git-command) "--git-dir" git-dir "merge-base" "--is-ancestor" x y] - {:keys [exit err] :as ret} (apply runproc opts args)] + [git-dir x y] + (let [{:keys [exit err] :as ret} (run-git "--git-dir" git-dir "merge-base" "--is-ancestor" x y)] (condp = exit 0 true 1 false (throw (ex-info (format "Unable to compare commits %s%n%s" git-dir err) ret))))) (defn commit-comparator - [git-dir opts x y] + [git-dir x y] (cond (= x y) 0 - (ancestor? git-dir x y opts) 1 - (ancestor? git-dir y x opts) -1 + (ancestor? git-dir x y) 1 + (ancestor? git-dir y x) -1 :else (throw (ex-info "" {})))) (defn match-exact diff --git a/src/test/clojure/clojure/tools/test_gitlibs.clj b/src/test/clojure/clojure/tools/test_gitlibs.clj index d1e1d84..6fd36a3 100644 --- a/src/test/clojure/clojure/tools/test_gitlibs.clj +++ b/src/test/clojure/clojure/tools/test_gitlibs.clj @@ -10,8 +10,7 @@ (:require [clojure.java.io :as jio] [clojure.test :refer :all] - [clojure.tools.gitlibs :as gl] - [clojure.tools.gitlibs.impl :as glim])) + [clojure.tools.gitlibs :as gl])) (def repo-url "https://github.com/clojure/spec.alpha.git") @@ -22,9 +21,9 @@ (deftest test-procure (let [wt1 (gl/procure repo-url 'org.clojure/spec.alpha "739c1af") wt2 (gl/procure repo-url 'org.clojure/spec.alpha "6a56327")] - (is (.exists (jio/file (glim/cache-dir) "_repos" "github.com" "clojure" "spec.alpha"))) - (is (= wt1 (.getAbsolutePath (jio/file (glim/cache-dir) "libs" "org.clojure" "spec.alpha" "739c1af56dae621aedf1bb282025a0d676eff713")))) - (is (= wt2 (.getAbsolutePath (jio/file (glim/cache-dir) "libs" "org.clojure" "spec.alpha" "6a56327446c909db0d11ecf93a3c3d659b739be9")))))) + (is (.exists (jio/file (gl/cache-dir) "_repos" "github.com" "clojure" "spec.alpha"))) + (is (= wt1 (.getAbsolutePath (jio/file (gl/cache-dir) "libs" "org.clojure" "spec.alpha" "739c1af56dae621aedf1bb282025a0d676eff713")))) + (is (= wt2 (.getAbsolutePath (jio/file (gl/cache-dir) "libs" "org.clojure" "spec.alpha" "6a56327446c909db0d11ecf93a3c3d659b739be9")))))) (deftest test-descendant-fixed (is (= (gl/descendant repo-url ["607aef0" "739c1af"]) From d06b03cb879b851a9c9773a203ab6d4d6fb0518e Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 12:16:31 -0600 Subject: [PATCH 020/105] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34dc79a..3aaffdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ Changelog * next * Change git options during checkout to work with more git versions + * Check exit code on checkout and throw if failed + * Overhaul config and debug settings + * Change min Clojure dep to 1.9 * 2.0.119 on Mar 10, 2021 * Fix issues with checkouts of multiple commits per repo * resolve now only fetches if it can't resolve a ref From e6523cc1f82662cdcd8250a174a4ac3cafdbb03d Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 12:17:07 -0600 Subject: [PATCH 021/105] update version template --- VERSION_TEMPLATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION_TEMPLATE b/VERSION_TEMPLATE index 677f189..8152c4b 100755 --- a/VERSION_TEMPLATE +++ b/VERSION_TEMPLATE @@ -1 +1 @@ -2.0.GENERATED_VERSION +2.1.GENERATED_VERSION From b8140f40df1ad461219b66017f9df57d1c9d7486 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 14:05:47 -0600 Subject: [PATCH 022/105] temporarily turn off tests in the build --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d4dbb7e..87ced2c 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ clojure-test - test + none test From 0e2667f3e06c75e83504764953bdf3e0804847e4 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Wed, 10 Mar 2021 14:09:01 -0600 Subject: [PATCH 023/105] [maven-release-plugin] prepare release tools.gitlibs-2.1.129 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 87ced2c..021ba1b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.0.120-SNAPSHOT + 2.1.129 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + tools.gitlibs-2.1.129 From a6b8626444c635a4fa37ed09580c49dbe5d98f66 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Wed, 10 Mar 2021 14:09:01 -0600 Subject: [PATCH 024/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 021ba1b..9229aae 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.1.129 + 2.1.130-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - tools.gitlibs-2.1.129 + HEAD From ae3e2a78687880cb24872b04dbaf1c24cf17b307 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 14:12:09 -0600 Subject: [PATCH 025/105] update for release --- CHANGELOG.md | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3aaffdd..4c53524 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.1.129 on Mar 10, 2021 * Change git options during checkout to work with more git versions * Check exit code on checkout and throw if failed * Overhaul config and debug settings diff --git a/README.md b/README.md index d9a89d4..d6a42ba 100644 --- a/README.md +++ b/README.md @@ -83,10 +83,10 @@ The cache location can also be set with the environment variable GITLIBS. This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.0.119 +Latest release: 2.1.129 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.0.119"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.1.129"}` # Developer Information From 2d14969bc4b041777106326f41b73a2e029aee36 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 15:32:38 -0600 Subject: [PATCH 026/105] re-enable tests --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9229aae..f30f44c 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ clojure-test - none + test test From 64799aa180f3fc75c375ac611ad87b39018801d2 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 15:45:05 -0600 Subject: [PATCH 027/105] sync up with opts --- src/main/clojure/clojure/tools/gitlibs.clj | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/clojure/clojure/tools/gitlibs.clj b/src/main/clojure/clojure/tools/gitlibs.clj index 1ff7efa..0c6939e 100644 --- a/src/main/clojure/clojure/tools/gitlibs.clj +++ b/src/main/clojure/clojure/tools/gitlibs.clj @@ -75,10 +75,8 @@ (defn tags "Returns coll of tags in git url" - ([url] - (tags url nil)) - ([url opts] - (impl/tags (impl/ensure-git-dir url opts) opts))) + [url] + (impl/tags (impl/ensure-git-dir url))) (comment (System/setProperty "clojure.gitlibs.debug" "true") @@ -94,5 +92,5 @@ @(future (procure "https://github.com/cognitect-labs/test-runner.git" 'cognitect-labs/test-runner "cb96e80f6f3d3b307c59cbeb49bb0dcb3a2a780b")) @(future (procure "https://github.com/cognitect-labs/test-runner.git" 'cognitect-labs/test-runner "9e1098965f2089c8cf492d23c0b7520f8690440a"))) - (tags "https://github.com/clojure/tools.gitlibs.git" {:print-commands true}) + (tags "https://github.com/clojure/tools.gitlibs.git") ) From c873f83042fd9c2524b0e6460d7411802800456b Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 10 Mar 2021 15:46:43 -0600 Subject: [PATCH 028/105] sync up git run impl --- src/main/clojure/clojure/tools/gitlibs/impl.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 076f138..4c3a0ed 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -141,8 +141,8 @@ (throw (IOException. (str "Prefix not unique: " prefix)))))))) (defn tags - [git-dir opts] - (let [{:keys [exit out err] :as ret} (runproc opts "git" "--git-dir" git-dir "tag")] + [git-dir] + (let [{:keys [exit out err] :as ret} (run-git "--git-dir" git-dir "tag")] (when-not (zero? exit) (throw (ex-info (format "Unable to get tags %s%n%s" git-dir err) ret))) - (remove str/blank? (str/split-lines out)))) \ No newline at end of file + (remove str/blank? (str/split-lines out)))) From c4fa9122e6234bce6212c9836c7ee38aec1769b5 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Thu, 11 Mar 2021 18:48:54 -0600 Subject: [PATCH 029/105] [maven-release-plugin] prepare release tools.gitlibs-2.1.139 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f30f44c..4647540 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.1.130-SNAPSHOT + 2.1.139 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + tools.gitlibs-2.1.139 From 8106906ab46d2c2a671808d14927a6d9361fe753 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Thu, 11 Mar 2021 18:48:54 -0600 Subject: [PATCH 030/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4647540..e74b301 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.1.139 + 2.1.140-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - tools.gitlibs-2.1.139 + HEAD From 6fed831f47e9d5f612e837084136e97af011ade4 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Thu, 11 Mar 2021 20:26:21 -0600 Subject: [PATCH 031/105] update changelog --- CHANGELOG.md | 2 ++ README.md | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c53524..c6f0bab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* 2.1.139 on Mar 11, 2021 + * Add tags method * 2.1.129 on Mar 10, 2021 * Change git options during checkout to work with more git versions * Check exit code on checkout and throw if failed diff --git a/README.md b/README.md index d6a42ba..a5c9718 100644 --- a/README.md +++ b/README.md @@ -83,10 +83,10 @@ The cache location can also be set with the environment variable GITLIBS. This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.1.129 +Latest release: 2.1.139 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.1.129"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.1.139"}` # Developer Information From 1d2d09617dab6f4b4723c2a063def35526382c7d Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Fri, 12 Mar 2021 14:48:03 -0600 Subject: [PATCH 032/105] fix rev-parse check for unfetched sha --- src/main/clojure/clojure/tools/gitlibs/impl.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 4c3a0ed..5d75222 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -98,7 +98,7 @@ (defn git-rev-parse [git-dir rev] - (let [{:keys [exit out]} (run-git "--git-dir" git-dir "rev-parse" rev)] + (let [{:keys [exit out]} (run-git "--git-dir" git-dir "rev-parse" (str rev "^{commit}"))] (when (zero? exit) (str/trimr out)))) From faff0110bf00ff99d2e70c7fad812acadbd3d2a4 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Fri, 12 Mar 2021 14:48:50 -0600 Subject: [PATCH 033/105] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6f0bab..11995ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * Fix rev-parse check on unfetched sha to report failure * 2.1.139 on Mar 11, 2021 * Add tags method * 2.1.129 on Mar 10, 2021 From 49edcbfba008ec901be7bd6d4f15affb157de218 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Fri, 12 Mar 2021 14:51:52 -0600 Subject: [PATCH 034/105] [maven-release-plugin] prepare release tools.gitlibs-2.1.144 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e74b301..3c2d148 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.1.140-SNAPSHOT + 2.1.144 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + tools.gitlibs-2.1.144 From 1224ccd8f8d64b2fe1305780473669dd1e6be4bf Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Fri, 12 Mar 2021 14:51:52 -0600 Subject: [PATCH 035/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 3c2d148..204c56a 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.1.144 + 2.1.145-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - tools.gitlibs-2.1.144 + HEAD From 6b2cb41c42d0096e66dcfafb871625de06fcd383 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Fri, 12 Mar 2021 15:13:31 -0600 Subject: [PATCH 036/105] update for release --- CHANGELOG.md | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11995ed..6ca15b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.1.144 on Mar 12, 2021 * Fix rev-parse check on unfetched sha to report failure * 2.1.139 on Mar 11, 2021 * Add tags method diff --git a/README.md b/README.md index a5c9718..2ef0872 100644 --- a/README.md +++ b/README.md @@ -83,10 +83,10 @@ The cache location can also be set with the environment variable GITLIBS. This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.1.139 +Latest release: 2.1.144 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.1.139"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.1.144"}` # Developer Information From 5682bb877d91a16dd61dc99a20bfacb890dd3ef5 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Tue, 16 Mar 2021 12:18:42 -0500 Subject: [PATCH 037/105] add config info --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2ef0872..f06ae08 100644 --- a/README.md +++ b/README.md @@ -54,11 +54,18 @@ The API functions all take revs, which can be any git rev that resolves to a com Procured working trees are always cached on the basis of the rev's full sha, so using `procure` repeatedly on a rev that does not resolve to a fixed sha may result in new checkouts in the cache. -### Cache directory +### Configuration Downloaded git dirs and working trees are stored in ~/.gitlibs - this directory is just a cache and can be safely removed if needed. -The cache location can also be set with the environment variable GITLIBS. +tools.gitlibs can be configured by either environment variable or Java system property. If both are provided, the Java system property takes precedence. + +| Env var | Java system property | default | description +| ------- | -------------------- | ------- | ----------- +| GITLIBS | clojure.gitlibs.dir | ~/.gitlibs | Local directory cache for git repos and working trees | +| GITLIBS_COMMAND | clojure.gitlibs.command | git | git command to run when shelling out (supply full path if needed) | +| GITLIBS_DEBUG | clojure.gitlibs.debug | false | If true, print git commands and output to stderr | +| GITLIBS_TERMINAL | clojure.gitlibs.terminal | false | If true, interactively prompt if needed | ## Example Usage From c6622bae2b0c1f44a0bcd1322e30724636320ac1 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Tue, 16 Mar 2021 12:20:01 -0500 Subject: [PATCH 038/105] remove auth note --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index f06ae08..7cf3787 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,6 @@ For more information on creating keys and using the ssh-agent to manage your ssh * https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ * https://help.github.com/articles/working-with-ssh-key-passphrases/ -*Note: user/password authentication is not supported for any protocol.* - ### Revs The API functions all take revs, which can be any git rev that resolves to a commit, such as: From 27dbb41d0d6c4bf19922a7776007afb969cf3db1 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sat, 3 Apr 2021 06:36:34 -0500 Subject: [PATCH 039/105] Fix issue with fetching new commits on branches Clone mirror (implies bare), but also sets a refspec for all branches. Fetch all to update all refs, also prune and prune tags to keep clean. --- src/main/clojure/clojure/tools/gitlibs/impl.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 5d75222..8ad1a69 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -62,7 +62,7 @@ [^File git-dir] (let [git-path (.getCanonicalPath git-dir) {:keys [exit err] :as ret} (run-git "--git-dir" git-path - "fetch" "--quiet" "--tags")] + "fetch" "--quiet" "--all" "--tags" "--prune" "--prune-tags")] (when-not (zero? exit) (throw (ex-info (format "Unable to fetch %s%n%s" git-path err) ret))))) @@ -71,7 +71,7 @@ [url ^File git-dir] (printerrln "Cloning:" url) (let [git-path (.getCanonicalPath git-dir) - {:keys [exit err] :as ret} (run-git "clone" "--quiet" "--bare" url git-path)] + {:keys [exit err] :as ret} (run-git "clone" "--quiet" "--mirror" url git-path)] (when-not (zero? exit) (throw (ex-info (format "Unable to clone %s%n%s" git-path err) ret))) git-dir)) From 37465ba9784e50071fb2599533ad438fda5c3058 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sat, 3 Apr 2021 06:38:31 -0500 Subject: [PATCH 040/105] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ca15b0..dfb9065 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * Fix issue with fetching new commits on branches * 2.1.144 on Mar 12, 2021 * Fix rev-parse check on unfetched sha to report failure * 2.1.139 on Mar 11, 2021 From 6135c0a01f651ad77e925714fb2937ad8ded40ba Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sat, 3 Apr 2021 06:38:56 -0500 Subject: [PATCH 041/105] update version template --- VERSION_TEMPLATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION_TEMPLATE b/VERSION_TEMPLATE index 8152c4b..59079ee 100755 --- a/VERSION_TEMPLATE +++ b/VERSION_TEMPLATE @@ -1 +1 @@ -2.1.GENERATED_VERSION +2.2.GENERATED_VERSION From a8dad0d0e0aea06271c9e1bf7c58a7faa29709be Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Sat, 3 Apr 2021 06:40:13 -0500 Subject: [PATCH 042/105] [maven-release-plugin] prepare release tools.gitlibs-2.2.152 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 204c56a..02e4b3c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.1.145-SNAPSHOT + 2.2.152 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + tools.gitlibs-2.2.152 From a88e2a48480e57b924322c950424f04482c3b1c5 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Sat, 3 Apr 2021 06:40:14 -0500 Subject: [PATCH 043/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 02e4b3c..7a2db73 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.2.152 + 2.2.153-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - tools.gitlibs-2.2.152 + HEAD From 947363ef9e93aae1737e682866ec5e095300f1ff Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sat, 3 Apr 2021 06:52:52 -0500 Subject: [PATCH 044/105] update for release --- CHANGELOG.md | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfb9065..e5156a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.2.152 on Apr 3, 2021 * Fix issue with fetching new commits on branches * 2.1.144 on Mar 12, 2021 * Fix rev-parse check on unfetched sha to report failure diff --git a/README.md b/README.md index 7cf3787..13d5d2b 100644 --- a/README.md +++ b/README.md @@ -88,10 +88,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.1.144 +Latest release: 2.2.152 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.1.144"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.2.152"}` # Developer Information From 25fb2cf3aa8c9bb306f2e3626666b95b0e9b6dde Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 7 Apr 2021 16:10:45 -0500 Subject: [PATCH 045/105] tags should fetch to ensure all tags are found --- CHANGELOG.md | 2 ++ src/main/clojure/clojure/tools/gitlibs.clj | 2 +- src/main/clojure/clojure/tools/gitlibs/impl.clj | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5156a8..7a3c2da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * `tags` api should fetch to ensure all tags are returned * 2.2.152 on Apr 3, 2021 * Fix issue with fetching new commits on branches * 2.1.144 on Mar 12, 2021 diff --git a/src/main/clojure/clojure/tools/gitlibs.clj b/src/main/clojure/clojure/tools/gitlibs.clj index 0c6939e..68bd935 100644 --- a/src/main/clojure/clojure/tools/gitlibs.clj +++ b/src/main/clojure/clojure/tools/gitlibs.clj @@ -74,7 +74,7 @@ (->> shas (sort (partial impl/commit-comparator git-dir)) first)))))) (defn tags - "Returns coll of tags in git url" + "Fetches, then returns coll of tags in git url" [url] (impl/tags (impl/ensure-git-dir url))) diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 8ad1a69..2b7a86c 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -141,7 +141,9 @@ (throw (IOException. (str "Prefix not unique: " prefix)))))))) (defn tags + "Fetch, then return all tags in the git dir. " [git-dir] + (git-fetch (jio/file git-dir)) (let [{:keys [exit out err] :as ret} (run-git "--git-dir" git-dir "tag")] (when-not (zero? exit) (throw (ex-info (format "Unable to get tags %s%n%s" git-dir err) ret))) From 167c0d198f760e672a38480bbf367e097a203b05 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Wed, 7 Apr 2021 16:14:23 -0500 Subject: [PATCH 046/105] [maven-release-plugin] prepare release tools.gitlibs-2.2.156 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7a2db73..d6ee2f4 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.2.153-SNAPSHOT + 2.2.156 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + tools.gitlibs-2.2.156 From 47761fa43578b07f076fd551ceacb88845841dba Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Wed, 7 Apr 2021 16:14:23 -0500 Subject: [PATCH 047/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d6ee2f4..2a29101 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.2.156 + 2.2.157-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - tools.gitlibs-2.2.156 + HEAD From a5a70c930a14869858ad534f4d68ff3ea01afacc Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 7 Apr 2021 16:19:37 -0500 Subject: [PATCH 048/105] update for release --- CHANGELOG.md | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a3c2da..8ac4f1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.2.156 on Apr 7, 2021 * `tags` api should fetch to ensure all tags are returned * 2.2.152 on Apr 3, 2021 * Fix issue with fetching new commits on branches diff --git a/README.md b/README.md index 13d5d2b..20bab5d 100644 --- a/README.md +++ b/README.md @@ -88,10 +88,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.2.152 +Latest release: 2.2.156 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.2.152"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.2.156"}` # Developer Information From 54a612361a60a38d30eb253d2f7a4e6bd8df13b8 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Fri, 9 Apr 2021 15:10:32 -0500 Subject: [PATCH 049/105] Add new object-type api method --- CHANGELOG.md | 2 ++ src/main/clojure/clojure/tools/gitlibs.clj | 11 +++++++++++ src/main/clojure/clojure/tools/gitlibs/impl.clj | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ac4f1e..546e98d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * Add new `object-type` api - takes rev, returns object type * 2.2.156 on Apr 7, 2021 * `tags` api should fetch to ensure all tags are returned * 2.2.152 on Apr 3, 2021 diff --git a/src/main/clojure/clojure/tools/gitlibs.clj b/src/main/clojure/clojure/tools/gitlibs.clj index 68bd935..86d7485 100644 --- a/src/main/clojure/clojure/tools/gitlibs.clj +++ b/src/main/clojure/clojure/tools/gitlibs.clj @@ -47,6 +47,17 @@ [url rev] (first (resolve-all url [rev]))) +(defn object-type + "Takes a git url and rev, and returns the object type, one of :tag :tree + :commit or :blob, or nil if not known or ambiguous." + [url rev] + (let [git-dir (impl/ensure-git-dir url)] + (if-let [type (impl/git-type git-dir rev)] + type + (do + (impl/git-fetch (jio/file git-dir)) + (impl/git-type git-dir rev))))) + (defn procure "Procure a working tree at rev for the git url representing the library lib, returns the directory path. lib is a qualified symbol where the qualifier is a diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 2b7a86c..e0467b9 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -102,6 +102,12 @@ (when (zero? exit) (str/trimr out)))) +(defn git-type + [git-dir rev] + (let [{:keys [exit out]} (run-git "--git-dir" git-dir "cat-file" "-t" rev)] + (when (zero? exit) + (keyword (str/trimr out))))) + ;; git merge-base --is-ancestor (defn- ancestor? [git-dir x y] From b8dd696b3e10bf43a54ceee9bf36159f784fa564 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Fri, 9 Apr 2021 15:11:20 -0500 Subject: [PATCH 050/105] update version template --- VERSION_TEMPLATE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION_TEMPLATE b/VERSION_TEMPLATE index 59079ee..22eec69 100755 --- a/VERSION_TEMPLATE +++ b/VERSION_TEMPLATE @@ -1 +1 @@ -2.2.GENERATED_VERSION +2.3.GENERATED_VERSION From 7956ec2de97b668dc6f5c5a3007358d1d6d241bc Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Fri, 9 Apr 2021 15:13:30 -0500 Subject: [PATCH 051/105] [maven-release-plugin] prepare release tools.gitlibs-2.3.161 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 2a29101..d078c52 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.2.157-SNAPSHOT + 2.3.161 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + tools.gitlibs-2.3.161 From 8da16ba1149590aba5dfb14a4a058df38f20f24b Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Fri, 9 Apr 2021 15:13:30 -0500 Subject: [PATCH 052/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d078c52..75b6976 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.3.161 + 2.3.162-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - tools.gitlibs-2.3.161 + HEAD From e03b365710ae80ef928902f5c60542e46cf64f47 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Fri, 9 Apr 2021 15:17:38 -0500 Subject: [PATCH 053/105] update for release --- CHANGELOG.md | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 546e98d..1d781db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.3.161 on Apr 9, 2021 * Add new `object-type` api - takes rev, returns object type * 2.2.156 on Apr 7, 2021 * `tags` api should fetch to ensure all tags are returned diff --git a/README.md b/README.md index 20bab5d..f3960dd 100644 --- a/README.md +++ b/README.md @@ -88,10 +88,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.2.156 +Latest release: 2.3.161 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.2.156"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.3.161"}` # Developer Information From f5ba62a558966aa23267c73d39485ed2e5916b18 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 14 Apr 2021 13:17:02 -0500 Subject: [PATCH 054/105] update parent pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 75b6976..6306e2f 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.clojure pom.contrib - 0.3.0 + 1.1.0 From 00a696ce3c478a2f33023bab63db91107bd43903 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 21 Apr 2021 15:19:22 -0500 Subject: [PATCH 055/105] Update broken links in readme --- README.md | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index f3960dd..b244848 100644 --- a/README.md +++ b/README.md @@ -9,43 +9,30 @@ To access git dependencies (for example, via tools.deps), one must download git and working trees as indicated by git shas. This library provides this functionality and also keeps a cache of git dirs and working trees that can be reused. -## Usage +## API The following API is provided in `clojure.tools.gitlibs`: * `(resolve git-url rev) ;; returns full sha of rev in git-url` * `(procure git-url lib rev) ;; returns working tree directory for git-url identified as lib at rev` * `(descendant git-url revs) ;; returns rev which is a descedant of all revs, or nil if none` +* `(tags git-url) ;; returns a collection of tags in this git-url (fetches to refresh)` +* `(cache-dir) ;; returns path to root of gitlibs cache dir` ### Git urls The following git url types are supported: -* `https` - for public anonymous clone and fetch of public repos -* `ssh` - for authenticated clone and fetch of private repos -* `http` and `git` protocols are plain-text and not supported or recommended - -### SSH authentication for private repositories - -ssh authentication works by connecting to the local ssh agent (ssh-agent on \*nix or Pageant via PuTTY on Windows). -The ssh-agent must have a registered identity for the key being used to access the Git repository. -To check whether you have registered identities, use: - -`ssh-add -l` - -which should return one or more registered identities, typically the one at `~/.ssh/id_rsa`. - -For more information on creating keys and using the ssh-agent to manage your ssh identities, GitHub provides excellent info: - -* https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ -* https://help.github.com/articles/working-with-ssh-key-passphrases/ +* `https` - for public anonymous clone and fetch of public or private repos with credentials via git credential sources +* `ssh` - for authenticated clone and fetch of private repos (uses ssh) +* `http` and `git` protocols are plain-text and NOT supported or recommended ### Revs The API functions all take revs, which can be any git rev that resolves to a commit, such as: * Full sha (40 chars) -* Prefix sha (sufficiently unique in the repo) +* Prefix sha (sufficiently unique in the repo, often 7 chars) * Tag name * Branch name @@ -54,7 +41,7 @@ repeatedly on a rev that does not resolve to a fixed sha may result in new check ### Configuration -Downloaded git dirs and working trees are stored in ~/.gitlibs - this directory is just a cache and can be safely removed if needed. +Downloaded git dirs and working trees are stored in the gitlibs cache dir, ~/.gitlibs by default. This directory is just a cache and can be safely removed if needed. tools.gitlibs can be configured by either environment variable or Java system property. If both are provided, the Java system property takes precedence. @@ -96,9 +83,8 @@ Latest release: 2.3.161 # Developer Information * [GitHub project](https://github.com/clojure/tools.gitlibs) -* [API Docs](https://clojure.github.io/tools.gitlibs) -* [How to contribute](https://dev.clojure.org/display/community/Contributing) -* [Bug Tracker](https://dev.clojure.org/jira/browse/TDEPS) +* [Bug Tracker](https://dev.clojure.org/jira/browse/TDEPS) - if you don't have an acct there, please ask at [Ask Clojure](https://ask.clojure.org) +* [How to contribute](https://clojure.org/dev/dev) * [Continuous Integration](https://build.clojure.org/job/gitlibs/) * [Compatibility Test Matrix](https://build.clojure.org/job/tools.gitlibs-matrix/) From 51c01c31ad22279d6548c3356acaf02428e1aecc Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Thu, 22 Apr 2021 15:14:43 -0500 Subject: [PATCH 056/105] remove --prune-tags flag to expand usable git versions --- src/main/clojure/clojure/tools/gitlibs/impl.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index e0467b9..6305eb0 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -61,8 +61,9 @@ (defn git-fetch [^File git-dir] (let [git-path (.getCanonicalPath git-dir) + ;; NOTE: --prune-tags would be desirable here but was added in git 2.17.0 {:keys [exit err] :as ret} (run-git "--git-dir" git-path - "fetch" "--quiet" "--all" "--tags" "--prune" "--prune-tags")] + "fetch" "--quiet" "--all" "--tags" "--prune")] (when-not (zero? exit) (throw (ex-info (format "Unable to fetch %s%n%s" git-path err) ret))))) From 99ab45ec5316235fae4a76457ec516ba3182b098 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Thu, 22 Apr 2021 15:17:01 -0500 Subject: [PATCH 057/105] [maven-release-plugin] prepare release v2.3.167 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 6306e2f..83f9c9f 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.3.162-SNAPSHOT + 2.3.167 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + v2.3.167 From a2c75e0b8909f6d84fbfcbc58e1964b54b5f74a9 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Thu, 22 Apr 2021 15:17:01 -0500 Subject: [PATCH 058/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 83f9c9f..e06359e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.3.167 + 2.3.168-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - v2.3.167 + HEAD From 270d340046e51269a0813e5c45c2a2755c11b490 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Thu, 22 Apr 2021 16:12:26 -0500 Subject: [PATCH 059/105] update for release --- CHANGELOG.md | 2 ++ README.md | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d781db..90beae6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* 2.3.167 on Apr 22, 2021 + * Remove use of `--prune-tags` with `git fetch` as that was only added in git 2.17.0 * 2.3.161 on Apr 9, 2021 * Add new `object-type` api - takes rev, returns object type * 2.2.156 on Apr 7, 2021 diff --git a/README.md b/README.md index b244848..22c01a3 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.3.161 +Latest release: 2.3.167 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.3.161"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.3.167"}` # Developer Information From bf214d5bfe0508b02a2a59d787466809d302285c Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Mon, 8 Nov 2021 13:50:57 -0600 Subject: [PATCH 060/105] TDEPS-212 Support local file git repos --- .../clojure/clojure/tools/gitlibs/impl.clj | 38 ++++++++++++++++--- .../clojure/tools/gitlibs/test_impl.clj | 36 ++++++++++++++++++ .../clojure/clojure/tools/test_gitlibs.clj | 2 +- 3 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 src/test/clojure/clojure/tools/gitlibs/test_impl.clj diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 6305eb0..a3f9c14 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -45,14 +45,40 @@ ^File [lib] (jio/file (:gitlibs/dir @config/CONFIG) "libs" (namespace lib) (name lib))) +(def ^:private git-url-regex + #"([a-z0-9+.-]+):\/\/(?:(?:(?:[^@]+?)@)?([^/]+?)(?::[0-9]*)?)?(/[^:]+)") + +(def ^:private git-scp-regex + #"(?:(?:[^@]+?)@)?(.+?):([^:]+)") + (defn- clean-url - "Chop leading protocol, trailing .git, replace :'s with /" + "Convert url into a safe relative path (this is not a reversible transformation) + based on scheme, host, and path (drop user and port). + + Examples: + ssh://git@gitlab.com:3333/org/repo.git => ssh/gitlab.com/org/repo + git@github.com:dotted.org/dotted.repo.git => ssh/github.com/dotted.org/dotted.repo + file://../foo => file/REL/_DOTDOT_/foo + file:///Users/user/foo.git => file/Users/user/foo + ../foo => file/REL/_DOTDOT_/foo + ~user/foo.git => file/REL/_TILDE_user/foo + + * https://git-scm.com/docs/git-clone#_git_urls + * https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols + " [url] - (-> url - (str/split #"://") - last - (str/replace #"\.git$" "") - (str/replace #":" "/"))) + (let [[scheme host path] (cond + (str/starts-with? url "file://") ["file" nil (-> url (subs 7) (str/replace #"^([^/])" "REL/$1"))] + (str/includes? url "://") (let [[_ s h p] (re-matches git-url-regex url)] [s h p]) + (str/includes? url ":") (let [[_ h p] (re-matches git-scp-regex url)] ["ssh" h p]) + :local-repo ["file" nil (str/replace url #"^([^/])" "REL/$1")]) + clean-path (-> path + (str/replace #"\.git/?$" "") ;; remove trailing .git or .git/ + (str/replace #"~" "_TILDE_")) ;; replace ~ with _TILDE_ + dir-parts (->> (concat [scheme host] (str/split clean-path #"/")) ;; split on / + (remove str/blank?) ;; remove any missing path segments + (map #(-> % ({"." "_DOT_", ".." "_DOTDOT_"} %))))] ;; replace . or .. segments + (str/join "/" dir-parts))) (defn git-dir ^File [url] diff --git a/src/test/clojure/clojure/tools/gitlibs/test_impl.clj b/src/test/clojure/clojure/tools/gitlibs/test_impl.clj new file mode 100644 index 0000000..ea732cd --- /dev/null +++ b/src/test/clojure/clojure/tools/gitlibs/test_impl.clj @@ -0,0 +1,36 @@ +(ns clojure.tools.gitlibs.test-impl + (:require + [clojure.test :refer :all] + [clojure.tools.gitlibs.impl :as impl])) + +(deftest test-clean-url + (are [url expected-path] + (= expected-path (#'impl/clean-url url)) + + ;; url formats - don't use user or port + "ssh://git@gitlab.com:3333/org/repo.git" "ssh/gitlab.com/org/repo" + "ssh://git@gitlab.org.net/org/repo.git" "ssh/gitlab.org.net/org/repo" + "ssh://user@host.xz/~user/repo.git/" "ssh/host.xz/_TILDE_user/repo" + "https://github.com/org/repo.git" "https/github.com/org/repo" + "git://host.xz/path/to/repo.git/" "git/host.xz/path/to/repo" + + ;; scp style url (most common github ssh url format) + "git@github.com:org/repo.git" "ssh/github.com/org/repo" + "git@github.com:dotted.org/dotted.repo.git" "ssh/github.com/dotted.org/dotted.repo" + "host.xz:~user/path/to/repo.git/" "ssh/host.xz/_TILDE_user/path/to/repo" + + ;; file scheme + "file:///Users/me/code/repo.git" "file/Users/me/code/repo" + "file://../foo.git" "file/REL/_DOTDOT_/foo" + "file://~/path/repo.git" "file/REL/_TILDE_/path/repo" + + ;; file repos - handle relative vs absolute, handle . .. ~ + "/Users/me/code/repo.git" "file/Users/me/code/repo" + "../foo.git" "file/REL/_DOTDOT_/foo" + "./foo.git" "file/REL/_DOT_/foo" + "~user/foo.git" "file/REL/_TILDE_user/foo" + + ;; git - unknown transport with url rewrite in gitconfig (unusual, but do something useful) + "work:repo.git" "ssh/work/repo")) + + diff --git a/src/test/clojure/clojure/tools/test_gitlibs.clj b/src/test/clojure/clojure/tools/test_gitlibs.clj index 6fd36a3..7c6b39a 100644 --- a/src/test/clojure/clojure/tools/test_gitlibs.clj +++ b/src/test/clojure/clojure/tools/test_gitlibs.clj @@ -21,7 +21,7 @@ (deftest test-procure (let [wt1 (gl/procure repo-url 'org.clojure/spec.alpha "739c1af") wt2 (gl/procure repo-url 'org.clojure/spec.alpha "6a56327")] - (is (.exists (jio/file (gl/cache-dir) "_repos" "github.com" "clojure" "spec.alpha"))) + (is (.exists (jio/file (gl/cache-dir) "_repos" "https" "github.com" "clojure" "spec.alpha"))) (is (= wt1 (.getAbsolutePath (jio/file (gl/cache-dir) "libs" "org.clojure" "spec.alpha" "739c1af56dae621aedf1bb282025a0d676eff713")))) (is (= wt2 (.getAbsolutePath (jio/file (gl/cache-dir) "libs" "org.clojure" "spec.alpha" "6a56327446c909db0d11ecf93a3c3d659b739be9")))))) From 8b699c68573d501bc49be6c805a17da1094ac1b2 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Mon, 8 Nov 2021 13:51:46 -0600 Subject: [PATCH 061/105] bump minor version --- CHANGELOG.md | 2 ++ VERSION_TEMPLATE | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90beae6..a15bd47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * TDEPS-212 - Support local file repos * 2.3.167 on Apr 22, 2021 * Remove use of `--prune-tags` with `git fetch` as that was only added in git 2.17.0 * 2.3.161 on Apr 9, 2021 diff --git a/VERSION_TEMPLATE b/VERSION_TEMPLATE index 22eec69..952ecf3 100755 --- a/VERSION_TEMPLATE +++ b/VERSION_TEMPLATE @@ -1 +1 @@ -2.3.GENERATED_VERSION +2.4.GENERATED_VERSION From e5c2dca4c10f458d3f63dcfa67a89211fe784fc2 Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Mon, 8 Nov 2021 13:56:07 -0600 Subject: [PATCH 062/105] [maven-release-plugin] prepare release v2.4.172 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e06359e..0be5a77 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.3.168-SNAPSHOT + 2.4.172 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + v2.4.172 From 6cc8947a2920226f30c47e16e19421e64325bf8a Mon Sep 17 00:00:00 2001 From: "Hudson @ build.clojure.org" Date: Mon, 8 Nov 2021 13:56:07 -0600 Subject: [PATCH 063/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0be5a77..14e9d0a 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.4.172 + 2.4.173-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - v2.4.172 + HEAD From 9f98af7631e34983d5b0886e1ab6eadc3856290b Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Mon, 8 Nov 2021 14:02:35 -0600 Subject: [PATCH 064/105] update for release --- CHANGELOG.md | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a15bd47..fb5d794 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.4.172 on Nov 8, 2021 * TDEPS-212 - Support local file repos * 2.3.167 on Apr 22, 2021 * Remove use of `--prune-tags` with `git fetch` as that was only added in git 2.17.0 diff --git a/README.md b/README.md index 22c01a3..51c5f3b 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.3.167 +Latest release: 2.4.172 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.3.167"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.4.172"}` # Developer Information From 1d9b4783436db0c767bbb1f43d361d6ccf40006c Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Thu, 16 Jun 2022 12:04:35 -0500 Subject: [PATCH 065/105] Add `commit-sha` api function to return commit sha for rev --- CHANGELOG.md | 2 ++ src/main/clojure/clojure/tools/gitlibs.clj | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb5d794..6e36e7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * Add `commit-sha` api function to return commit sha for rev * 2.4.172 on Nov 8, 2021 * TDEPS-212 - Support local file repos * 2.3.167 on Apr 22, 2021 diff --git a/src/main/clojure/clojure/tools/gitlibs.clj b/src/main/clojure/clojure/tools/gitlibs.clj index 86d7485..fc6bd67 100644 --- a/src/main/clojure/clojure/tools/gitlibs.clj +++ b/src/main/clojure/clojure/tools/gitlibs.clj @@ -89,7 +89,14 @@ [url] (impl/tags (impl/ensure-git-dir url))) +(defn commit-sha + "Returns unpeeled full commit sha, given a rev (which may be tag, branch, etc)" + [url rev] + (impl/git-rev-parse (impl/ensure-git-dir url) rev)) + (comment + (commit-sha "https://github.com/clojure/tools.build.git" "v0.8.2") + (System/setProperty "clojure.gitlibs.debug" "true") (resolve "git@github.com:clojure/tools.gitlibs.git" "11fc774") (descendant "https://github.com/clojure/tools.gitlibs.git" ["5e2797a487c" "11fc774" "d82adc29" "815e312310"]) From 62905dd74be9fe422c413e7ab4906a75f07bb027 Mon Sep 17 00:00:00 2001 From: Clojure Build Date: Thu, 16 Jun 2022 12:12:47 -0500 Subject: [PATCH 066/105] [maven-release-plugin] prepare release v2.4.176 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 14e9d0a..6c1b924 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.4.173-SNAPSHOT + 2.4.176 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + v2.4.176 From d82bf0228af1d17dbaa96303162873b52c129cd0 Mon Sep 17 00:00:00 2001 From: Clojure Build Date: Thu, 16 Jun 2022 12:12:47 -0500 Subject: [PATCH 067/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 6c1b924..5dc08ee 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.4.176 + 2.4.177-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - v2.4.176 + HEAD From 11eca7f76ab632b334a3753c6ea4447527fad303 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Thu, 16 Jun 2022 12:17:06 -0500 Subject: [PATCH 068/105] update for release --- CHANGELOG.md | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e36e7f..b80c55f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.4.176 on Jun 16, 2022 * Add `commit-sha` api function to return commit sha for rev * 2.4.172 on Nov 8, 2021 * TDEPS-212 - Support local file repos diff --git a/README.md b/README.md index 51c5f3b..d0f6f25 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.4.172 +Latest release: 2.4.176 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.4.172"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.4.176"}` # Developer Information @@ -90,7 +90,7 @@ Latest release: 2.4.172 # Copyright and License -Copyright © 2018-2021 Rich Hickey, Alex Miller, and contributors +Copyright © 2018-2022 Rich Hickey, Alex Miller, and contributors All rights reserved. The use and distribution terms for this software are covered by the From 1fd37b79a1422a7661cfa817b63b845f601b83f7 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sun, 19 Jun 2022 20:37:19 -0500 Subject: [PATCH 069/105] Sort tags in version order --- src/main/clojure/clojure/tools/gitlibs/impl.clj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index a3f9c14..cda306b 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -174,10 +174,10 @@ (throw (IOException. (str "Prefix not unique: " prefix)))))))) (defn tags - "Fetch, then return all tags in the git dir. " + "Fetch, then return all tags in the git dir." [git-dir] (git-fetch (jio/file git-dir)) - (let [{:keys [exit out err] :as ret} (run-git "--git-dir" git-dir "tag")] + (let [{:keys [exit out err] :as ret} (run-git "--git-dir" git-dir "tag" "--sort=v:refname")] (when-not (zero? exit) (throw (ex-info (format "Unable to get tags %s%n%s" git-dir err) ret))) (remove str/blank? (str/split-lines out)))) From b02e313d4fe380225dedfa17465bc65381d54453 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sun, 19 Jun 2022 20:38:49 -0500 Subject: [PATCH 070/105] sort tags in version order --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b80c55f..6f875c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * Sort tags in version order * 2.4.176 on Jun 16, 2022 * Add `commit-sha` api function to return commit sha for rev * 2.4.172 on Nov 8, 2021 From 700531b68a2d0f73ec92b802b5e1be34a3cdf4d4 Mon Sep 17 00:00:00 2001 From: Clojure Build Date: Sun, 19 Jun 2022 20:43:42 -0500 Subject: [PATCH 071/105] [maven-release-plugin] prepare release v2.4.181 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5dc08ee..89e384c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.4.177-SNAPSHOT + 2.4.181 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + v2.4.181 From fb67b3c53dbfa9faff03fe4cbb2b25bed5ada393 Mon Sep 17 00:00:00 2001 From: Clojure Build Date: Sun, 19 Jun 2022 20:43:42 -0500 Subject: [PATCH 072/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 89e384c..214a3cb 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.4.181 + 2.4.182-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - v2.4.181 + HEAD From 686451f9432246f2298ea77c3ec8ab3c92a3654d Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sun, 19 Jun 2022 20:48:47 -0500 Subject: [PATCH 073/105] update for release --- CHANGELOG.md | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f875c4..b03c8ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.4.181 on Jun 19, 2022 * Sort tags in version order * 2.4.176 on Jun 16, 2022 * Add `commit-sha` api function to return commit sha for rev diff --git a/README.md b/README.md index d0f6f25..8139afa 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.4.176 +Latest release: 2.4.181 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.4.176"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.4.181"}` # Developer Information From 15b44f315b71515cc2a96f82cad75355fd9e5cca Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sat, 11 Feb 2023 22:37:21 -0600 Subject: [PATCH 074/105] update gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index ce07fda..bd71089 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ target/ .nrepl* .cpcache .lein* +.calva/ +.clj-kondo/ +.lsp/ From 81b247af7567cce2972c3798c1ce7f5d9c690fcd Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sat, 11 Feb 2023 22:38:18 -0600 Subject: [PATCH 075/105] Avoid blocking on large git output --- CHANGELOG.md | 2 ++ src/main/clojure/clojure/tools/gitlibs.clj | 3 +++ .../clojure/clojure/tools/gitlibs/impl.clj | 22 ++++++++++++++----- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b03c8ca..4c582a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * Don't block on big git output * 2.4.181 on Jun 19, 2022 * Sort tags in version order * 2.4.176 on Jun 16, 2022 diff --git a/src/main/clojure/clojure/tools/gitlibs.clj b/src/main/clojure/clojure/tools/gitlibs.clj index fc6bd67..3662a9b 100644 --- a/src/main/clojure/clojure/tools/gitlibs.clj +++ b/src/main/clojure/clojure/tools/gitlibs.clj @@ -111,4 +111,7 @@ @(future (procure "https://github.com/cognitect-labs/test-runner.git" 'cognitect-labs/test-runner "9e1098965f2089c8cf492d23c0b7520f8690440a"))) (tags "https://github.com/clojure/tools.gitlibs.git") + + ;; big output + (tags "https://github.com/confluentinc/kafka-streams-examples.git") ) diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index cda306b..00d58a0 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -14,7 +14,7 @@ [clojure.tools.gitlibs.config :as config]) (:import [java.lang ProcessBuilder$Redirect] - [java.io File FilenameFilter IOException])) + [java.io File FilenameFilter InputStream IOException StringWriter])) (set! *warn-on-reflection* true) @@ -24,6 +24,16 @@ (binding [*out* *err*] (apply println msgs))) +(defn capture + "Reads from input-stream until EOF and returns a String (or nil if 0 length). + Takes same opts as clojure.java.io/copy - :buffer and :encoding" + [^InputStream input-stream] + (let [writer (StringWriter.)] + (jio/copy input-stream writer) + (let [s (str/trim (.toString writer))] + (when-not (zero? (.length s)) + s)))) + (defn- run-git [& args] (let [{:gitlibs/keys [command debug terminal]} @config/CONFIG @@ -34,10 +44,10 @@ _ (when debug (.redirectError proc-builder ProcessBuilder$Redirect/INHERIT)) _ (when-not terminal (.put (.environment proc-builder) "GIT_TERMINAL_PROMPT" "0")) proc (.start proc-builder) - exit (.waitFor proc) - out (slurp (.getInputStream proc)) - err (slurp (.getErrorStream proc))] ;; if debug is true, stderr will be redirected instead - {:args command-args, :exit exit, :out out, :err err}))) + out (future (capture (.getInputStream proc))) + err (future (capture (.getErrorStream proc))) ;; if debug is true, stderr will be redirected instead + exit (.waitFor proc)] + {:args command-args, :exit exit, :out @out, :err @err}))) ;; dirs @@ -135,7 +145,7 @@ (when (zero? exit) (keyword (str/trimr out))))) -;; git merge-base --is-ancestor +;; git merge-base --is-ancestor (defn- ancestor? [git-dir x y] (let [{:keys [exit err] :as ret} (run-git "--git-dir" git-dir "merge-base" "--is-ancestor" x y)] From 0196a767e795bc5e4391acac4c7e01df9c56100c Mon Sep 17 00:00:00 2001 From: Clojure Build Date: Sat, 11 Feb 2023 22:42:11 -0600 Subject: [PATCH 076/105] [maven-release-plugin] prepare release v2.5.186 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 214a3cb..ada023d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.4.182-SNAPSHOT + 2.5.186 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + v2.5.186 From 9e62041f1ab5840288d5ab963faa3038808b39b5 Mon Sep 17 00:00:00 2001 From: Clojure Build Date: Sat, 11 Feb 2023 22:42:11 -0600 Subject: [PATCH 077/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ada023d..10d2204 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.5.186 + 2.5.187-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - v2.5.186 + HEAD From 9a0b91c123143269c9d81b6a258bd3097c95c937 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sat, 11 Feb 2023 22:44:46 -0600 Subject: [PATCH 078/105] update for release --- CHANGELOG.md | 2 +- README.md | 4 ++-- VERSION_TEMPLATE | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c582a3..7927fe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.5.186 on Feb 11, 2023 * Don't block on big git output * 2.4.181 on Jun 19, 2022 * Sort tags in version order diff --git a/README.md b/README.md index 8139afa..f546f3c 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.4.181 +Latest release: 2.5.186 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.4.181"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.5.186"}` # Developer Information diff --git a/VERSION_TEMPLATE b/VERSION_TEMPLATE index 952ecf3..1ff029e 100755 --- a/VERSION_TEMPLATE +++ b/VERSION_TEMPLATE @@ -1 +1 @@ -2.4.GENERATED_VERSION +2.5.GENERATED_VERSION From 2729699544a3549e9295d2aa35ba80bd37c7d533 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sun, 12 Feb 2023 00:47:04 -0600 Subject: [PATCH 079/105] Do not use future to background the process reading (leaves non-daemon thread) --- CHANGELOG.md | 2 ++ src/main/clojure/clojure/tools/gitlibs/impl.clj | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7927fe0..8125f94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * Don't use future to background the process reading (leaves non-daemon thread) * 2.5.186 on Feb 11, 2023 * Don't block on big git output * 2.4.181 on Jun 19, 2022 diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 00d58a0..28ea1ad 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -24,9 +24,8 @@ (binding [*out* *err*] (apply println msgs))) -(defn capture - "Reads from input-stream until EOF and returns a String (or nil if 0 length). - Takes same opts as clojure.java.io/copy - :buffer and :encoding" +(defn- capture + "Reads from input-stream until EOF and returns a String (or nil if 0 length)." [^InputStream input-stream] (let [writer (StringWriter.)] (jio/copy input-stream writer) @@ -34,6 +33,14 @@ (when-not (zero? (.length s)) s)))) +(defmacro background + [& body] + `(let [result# (promise)] + (doto (Thread. (fn [] (deliver result# (do ~@body)))) + (.setDaemon true) + (.start)) + result#)) + (defn- run-git [& args] (let [{:gitlibs/keys [command debug terminal]} @config/CONFIG @@ -44,8 +51,8 @@ _ (when debug (.redirectError proc-builder ProcessBuilder$Redirect/INHERIT)) _ (when-not terminal (.put (.environment proc-builder) "GIT_TERMINAL_PROMPT" "0")) proc (.start proc-builder) - out (future (capture (.getInputStream proc))) - err (future (capture (.getErrorStream proc))) ;; if debug is true, stderr will be redirected instead + out (background (capture (.getInputStream proc))) + err (background (capture (.getErrorStream proc))) ;; if debug is true, stderr will be redirected instead exit (.waitFor proc)] {:args command-args, :exit exit, :out @out, :err @err}))) From 44dc4b618786e76d7adef51f860eddd8b7291273 Mon Sep 17 00:00:00 2001 From: Clojure Build Date: Sun, 12 Feb 2023 00:48:10 -0600 Subject: [PATCH 080/105] [maven-release-plugin] prepare release v2.5.190 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 10d2204..bd23ea0 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.5.187-SNAPSHOT + 2.5.190 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + v2.5.190 From 0ce814604d81b0361a6f91361b6e665117415d5d Mon Sep 17 00:00:00 2001 From: Clojure Build Date: Sun, 12 Feb 2023 00:48:10 -0600 Subject: [PATCH 081/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index bd23ea0..837b0f6 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.5.190 + 2.5.191-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - v2.5.190 + HEAD From e421eb7a0b526d7c786f3e780e975377c664c321 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sun, 12 Feb 2023 00:58:41 -0600 Subject: [PATCH 082/105] update for release --- CHANGELOG.md | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8125f94..722da29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.5.190 on Feb 12, 2023 * Don't use future to background the process reading (leaves non-daemon thread) * 2.5.186 on Feb 11, 2023 * Don't block on big git output diff --git a/README.md b/README.md index f546f3c..da5aa96 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.5.186 +Latest release: 2.5.190 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.5.186"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.5.190"}` # Developer Information @@ -90,7 +90,7 @@ Latest release: 2.5.186 # Copyright and License -Copyright © 2018-2022 Rich Hickey, Alex Miller, and contributors +Copyright © 2018-2023 Rich Hickey, Alex Miller, and contributors All rights reserved. The use and distribution terms for this software are covered by the From d3052a4392a03a869498dedaaf08a7b8fffefffb Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Sun, 12 Feb 2023 10:42:35 -0600 Subject: [PATCH 083/105] update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index bd71089..62df01d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ target/ .calva/ .clj-kondo/ .lsp/ +.vscode/ From 6feba28e51225b3f504cbd4fd188a8de1212943e Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 31 May 2023 12:06:08 -0500 Subject: [PATCH 084/105] TDEPS-248 - Make `tags` return known tags when offline --- CHANGELOG.md | 2 ++ src/main/clojure/clojure/tools/gitlibs/impl.clj | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 722da29..e7df0ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * TDEPS-248 - Make `tags` return known tags when offline * 2.5.190 on Feb 12, 2023 * Don't use future to background the process reading (leaves non-daemon thread) * 2.5.186 on Feb 11, 2023 diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 28ea1ad..7b51677 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -101,6 +101,15 @@ ^File [url] (jio/file (:gitlibs/dir @config/CONFIG) "_repos" (clean-url url))) +(defn git-try-fetch + "Try to fetch and return the error code (0=success)" + [^File git-dir] + (let [git-path (.getCanonicalPath git-dir) + ;; NOTE: --prune-tags would be desirable here but was added in git 2.17.0 + {:keys [exit]} (run-git "--git-dir" git-path + "fetch" "--quiet" "--all" "--tags" "--prune")] + exit)) + (defn git-fetch [^File git-dir] (let [git-path (.getCanonicalPath git-dir) @@ -193,7 +202,7 @@ (defn tags "Fetch, then return all tags in the git dir." [git-dir] - (git-fetch (jio/file git-dir)) + (git-try-fetch (jio/file git-dir)) (let [{:keys [exit out err] :as ret} (run-git "--git-dir" git-dir "tag" "--sort=v:refname")] (when-not (zero? exit) (throw (ex-info (format "Unable to get tags %s%n%s" git-dir err) ret))) From c43baabfb0432ab0a33519114fa1a5350cc137a8 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 31 May 2023 12:07:52 -0500 Subject: [PATCH 085/105] add workflows --- .github/workflows/release.yml | 19 +++++++++++++++++++ .github/workflows/snapshot.yml | 8 ++++++++ .github/workflows/test.yml | 7 +++++++ 3 files changed, 34 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/snapshot.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e2718bd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,19 @@ +name: Release on demand + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: "Version to release" + required: true + snapshotVersion: + description: "Snapshot version after release" + required: true + +jobs: + call-release: + uses: clojure/build.ci/.github/workflows/release.yml@master + with: + releaseVersion: ${{ github.event.inputs.releaseVersion }} + snapshotVersion: ${{ github.event.inputs.snapshotVersion }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml new file mode 100644 index 0000000..2472957 --- /dev/null +++ b/.github/workflows/snapshot.yml @@ -0,0 +1,8 @@ +name: Snapshot on demand + +on: [workflow_dispatch] + +jobs: + call-snapshot: + uses: clojure/build.ci/.github/workflows/snapshot.yml@master + secrets: inherit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1fa127c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,7 @@ +name: Test + +on: [push] + +jobs: + call-test: + uses: clojure/build.ci/.github/workflows/test.yml@master From 47beb7aa95cead96b59e323d0e8be24efc56eac8 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 31 May 2023 12:09:19 -0500 Subject: [PATCH 086/105] update CI link in readme --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index da5aa96..7feee91 100644 --- a/README.md +++ b/README.md @@ -85,8 +85,7 @@ Latest release: 2.5.190 * [GitHub project](https://github.com/clojure/tools.gitlibs) * [Bug Tracker](https://dev.clojure.org/jira/browse/TDEPS) - if you don't have an acct there, please ask at [Ask Clojure](https://ask.clojure.org) * [How to contribute](https://clojure.org/dev/dev) -* [Continuous Integration](https://build.clojure.org/job/gitlibs/) -* [Compatibility Test Matrix](https://build.clojure.org/job/tools.gitlibs-matrix/) +* [Continuous Integration](https://github.com/clojure/tools.gitlibs/actions/workflows/test.yml) # Copyright and License From 008d5bdaf6ad6e5cb39b5523cddb409703b39fcc Mon Sep 17 00:00:00 2001 From: clojure-build Date: Wed, 31 May 2023 17:11:45 +0000 Subject: [PATCH 087/105] [maven-release-plugin] prepare release v2.5.197 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 837b0f6..97acbbe 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.5.191-SNAPSHOT + 2.5.197 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + v2.5.197 From 09f1bd74ed60fe64c3fb9e54359a9af74962bd5e Mon Sep 17 00:00:00 2001 From: clojure-build Date: Wed, 31 May 2023 17:11:45 +0000 Subject: [PATCH 088/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 97acbbe..fa5cb10 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.5.197 + 2.5.198-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - v2.5.197 + HEAD From 77355af30a82fe2f2797a019cf1a7a71d4ac3d3a Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 31 May 2023 12:16:03 -0500 Subject: [PATCH 089/105] update for release --- CHANGELOG.md | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7df0ad..06505bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.5.198 on May 31, 2023 * TDEPS-248 - Make `tags` return known tags when offline * 2.5.190 on Feb 12, 2023 * Don't use future to background the process reading (leaves non-daemon thread) diff --git a/README.md b/README.md index 7feee91..dc3121b 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.5.190 +Latest release: 2.5.198 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.5.190"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.5.198"}` # Developer Information From f6544f4dab32c5d5f1610d6c2a5a256d23226821 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Wed, 31 May 2023 13:34:45 -0500 Subject: [PATCH 090/105] fix version number --- CHANGELOG.md | 2 +- README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06505bb..e6c0937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* 2.5.198 on May 31, 2023 +* 2.5.197 on May 31, 2023 * TDEPS-248 - Make `tags` return known tags when offline * 2.5.190 on Feb 12, 2023 * Don't use future to background the process reading (leaves non-daemon thread) diff --git a/README.md b/README.md index dc3121b..3ea62e0 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.5.198 +Latest release: 2.5.197 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.5.198"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.5.197"}` # Developer Information From 87d029dc0e78fad3ff7b276b1d89bc653820b869 Mon Sep 17 00:00:00 2001 From: JarrodCTaylor Date: Wed, 16 Aug 2023 13:50:33 -0500 Subject: [PATCH 091/105] Added github action to build api docs --- .github/workflows/doc-build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/doc-build.yml diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml new file mode 100644 index 0000000..628bb24 --- /dev/null +++ b/.github/workflows/doc-build.yml @@ -0,0 +1,10 @@ +name: Build API Docs + +on: + workflow_dispatch: + +jobs: + call-doc-build-workflow: + uses: clojure/build.ci/.github/workflows/doc-build.yml@master + with: + project: clojure/tools.gitlibs From bba2b283211148dad2707422d534bacb9fcf6176 Mon Sep 17 00:00:00 2001 From: JarrodCTaylor Date: Wed, 30 Aug 2023 22:52:30 -0500 Subject: [PATCH 092/105] Fix EPL license link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3ea62e0..ac5ba14 100644 --- a/README.md +++ b/README.md @@ -99,4 +99,4 @@ in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software. -[Eclipse Public License 1.0]: http://opensource.org/licenses/eclipse-1.0.php +[Eclipse Public License 1.0]: https://opensource.org/license/epl-1-0/ From 867eb6881f714bf5c854f471d962f6dd131e1917 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Mon, 19 Feb 2024 13:03:50 -0600 Subject: [PATCH 093/105] update parent pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fa5cb10..a8dfc05 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.clojure pom.contrib - 1.1.0 + 1.2.0 From bc32b85345bfaf1f090702bda372de4eda64aca2 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Thu, 5 Dec 2024 11:17:06 -0600 Subject: [PATCH 094/105] Improve error message when clone fails to include url --- CHANGELOG.md | 2 ++ src/main/clojure/clojure/tools/gitlibs/impl.clj | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6c0937..abf12d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * Improve error message when clone fails to include url * 2.5.197 on May 31, 2023 * TDEPS-248 - Make `tags` return known tags when offline * 2.5.190 on Feb 12, 2023 diff --git a/src/main/clojure/clojure/tools/gitlibs/impl.clj b/src/main/clojure/clojure/tools/gitlibs/impl.clj index 7b51677..62e6ef9 100644 --- a/src/main/clojure/clojure/tools/gitlibs/impl.clj +++ b/src/main/clojure/clojure/tools/gitlibs/impl.clj @@ -126,7 +126,7 @@ (let [git-path (.getCanonicalPath git-dir) {:keys [exit err] :as ret} (run-git "clone" "--quiet" "--mirror" url git-path)] (when-not (zero? exit) - (throw (ex-info (format "Unable to clone %s%n%s" git-path err) ret))) + (throw (ex-info (format "Unable to clone %s to %s:%n%s" url git-path err) ret))) git-dir)) (defn ensure-git-dir From 17b1cf0678fa5e8622f456b73ae7702ff10c4425 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Thu, 5 Dec 2024 11:20:01 -0600 Subject: [PATCH 095/105] Bump Clojure dep to 1.11.4 --- CHANGELOG.md | 1 + VERSION_TEMPLATE | 2 +- deps.edn | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abf12d5..a53b55f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Changelog =========== * next + * Bump clojure dep to 1.11.4 * Improve error message when clone fails to include url * 2.5.197 on May 31, 2023 * TDEPS-248 - Make `tags` return known tags when offline diff --git a/VERSION_TEMPLATE b/VERSION_TEMPLATE index 1ff029e..0cfa6a1 100755 --- a/VERSION_TEMPLATE +++ b/VERSION_TEMPLATE @@ -1 +1 @@ -2.5.GENERATED_VERSION +2.6.GENERATED_VERSION diff --git a/deps.edn b/deps.edn index eff4f54..1fafc86 100644 --- a/deps.edn +++ b/deps.edn @@ -1,2 +1,2 @@ {:paths ["src/main/clojure"] - :deps {org.clojure/clojure {:mvn/version "1.9.0"}}} + :deps {org.clojure/clojure {:mvn/version "1.11.4"}}} diff --git a/pom.xml b/pom.xml index a8dfc05..a0a4161 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ true - 1.9.0 + 1.11.4 From d34ba6d489455b30828a7286538934891130de6d Mon Sep 17 00:00:00 2001 From: clojure-build Date: Thu, 5 Dec 2024 17:21:47 +0000 Subject: [PATCH 096/105] [maven-release-plugin] prepare release v2.6.206 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a0a4161..05742f3 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.5.198-SNAPSHOT + 2.6.206 tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + v2.6.206 From 645555242b81c91898e7d46a890b8fb23d7d1c09 Mon Sep 17 00:00:00 2001 From: clojure-build Date: Thu, 5 Dec 2024 17:21:47 +0000 Subject: [PATCH 097/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 05742f3..b935e75 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.6.206 + 2.6.207-SNAPSHOT tools.gitlibs @@ -66,6 +66,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - v2.6.206 + HEAD From 3663b5fbd84217ce0bfc45b3badf2640f6255cd8 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Thu, 5 Dec 2024 11:33:05 -0600 Subject: [PATCH 098/105] update for release --- CHANGELOG.md | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a53b55f..71ce7dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.6.206 on Dec 5, 2024 * Bump clojure dep to 1.11.4 * Improve error message when clone fails to include url * 2.5.197 on May 31, 2023 diff --git a/README.md b/README.md index ac5ba14..385b0a6 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.5.197 +Latest release: 2.6.206 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.5.197"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.6.206"}` # Developer Information @@ -89,7 +89,7 @@ Latest release: 2.5.197 # Copyright and License -Copyright © 2018-2023 Rich Hickey, Alex Miller, and contributors +Copyright © Rich Hickey, Alex Miller, and contributors All rights reserved. The use and distribution terms for this software are covered by the From 48ce731bc7c7e780302785b106af9ee81a28df88 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Fri, 30 May 2025 15:22:50 -0500 Subject: [PATCH 099/105] update to new parent pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b935e75..a434bfb 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.clojure pom.contrib - 1.2.0 + 1.3.0 From e43a79a67327485797a53a10faf42bc6a63771b0 Mon Sep 17 00:00:00 2001 From: Fogus Date: Tue, 21 Oct 2025 08:29:53 -0400 Subject: [PATCH 100/105] Add project description to pom.xml Added a description for the project in pom.xml. --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index a434bfb..0214db1 100644 --- a/pom.xml +++ b/pom.xml @@ -3,6 +3,7 @@ tools.gitlibs 2.6.207-SNAPSHOT tools.gitlibs + API for retrieving, caching, and programatically accessing git libraries from Clojure. org.clojure From 1a5b23e79d0ae9720506ca7cf3d1a8692d5b9867 Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Tue, 30 Dec 2025 15:50:04 -0600 Subject: [PATCH 101/105] update to latest parent pom --- CHANGELOG.md | 2 ++ pom.xml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71ce7dc..7a3a5f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ Changelog =========== +* next + * Bump parent pom to latest * 2.6.206 on Dec 5, 2024 * Bump clojure dep to 1.11.4 * Improve error message when clone fails to include url diff --git a/pom.xml b/pom.xml index 0214db1..8e32ac3 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.clojure pom.contrib - 1.3.0 + 1.4.0 From 8c81ac5a537c4b7982d237b89ec3e374fa581599 Mon Sep 17 00:00:00 2001 From: clojure-build Date: Tue, 30 Dec 2025 21:51:35 +0000 Subject: [PATCH 102/105] [maven-release-plugin] prepare release v2.6.212 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8e32ac3..0eb1d95 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.6.207-SNAPSHOT + 2.6.212 tools.gitlibs API for retrieving, caching, and programatically accessing git libraries from Clojure. @@ -67,6 +67,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - HEAD + v2.6.212 From 2a9c1e1d1be0ceda59ca2ed8013b5b930f31243e Mon Sep 17 00:00:00 2001 From: clojure-build Date: Tue, 30 Dec 2025 21:51:35 +0000 Subject: [PATCH 103/105] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0eb1d95..61e9342 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ 4.0.0 tools.gitlibs - 2.6.212 + 2.6.213-SNAPSHOT tools.gitlibs API for retrieving, caching, and programatically accessing git libraries from Clojure. @@ -67,6 +67,6 @@ scm:git:git@github.com:clojure/tools.gitlibs.git scm:git:git@github.com:clojure/tools.gitlibs.git git@github.com:clojure/tools.gitlibs.git - v2.6.212 + HEAD From b99784dec4f7fe715313538d9ce546bb9af4b39e Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Thu, 5 Mar 2026 17:46:54 -0600 Subject: [PATCH 104/105] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a3a5f6..83a1097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ Changelog =========== -* next +* 2.6.212 on Dec 30, 2025 * Bump parent pom to latest * 2.6.206 on Dec 5, 2024 * Bump clojure dep to 1.11.4 From 3af800ec28108e91ccc8f67c477eeace1c895a5f Mon Sep 17 00:00:00 2001 From: Alex Miller Date: Thu, 5 Mar 2026 17:47:15 -0600 Subject: [PATCH 105/105] update for release --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 385b0a6..5125bde 100644 --- a/README.md +++ b/README.md @@ -75,10 +75,10 @@ tools.gitlibs can be configured by either environment variable or Java system pr This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. -Latest release: 2.6.206 +Latest release: 2.6.212 * [All released versions](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.clojure%22%20AND%20a%3A%22tools.gitlibs%22) -* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.6.206"}` +* Coordinates: `org.clojure/tools.gitlibs {:mvn/version "2.6.212"}` # Developer Information