Skip to content

Commit 716734a

Browse files
committed
Libs tests should no longer pollute ./.git
Some libs under test effect changes to the .git dir. I think at least update-leiningen-dependencies-skill is doing this? We don't want them messing with rewrite-clj's .git dir, so now performing a git init in ./target/lib-test root dir to foil their attempts.
1 parent 23e41df commit 716734a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

script/libs_tests.clj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,14 @@
359359
test-cmds))]
360360
(assoc lib :exit-codes exit-codes))))
361361

362+
(defn- prep-target [target-root-dir]
363+
(status/line :info "Prep target")
364+
(status/line :detail (format "(re)creating: %s" target-root-dir))
365+
(when (fs/exists? target-root-dir) (fs/delete-tree target-root-dir))
366+
(.mkdirs (fs/file target-root-dir))
367+
(status/line :detail "git init-ing target to avoid polluting our project git config/hooks with any changes libs under test might effect")
368+
(shcmd ["git" "init"] {:dir target-root-dir}))
369+
362370
(defn main [args]
363371
;; no args = test all libs
364372
;; or specify which libs, by name, to test (in order specified)
@@ -373,10 +381,10 @@
373381
[]
374382
args))
375383
target-root-dir "target/libs-test"
376-
_ (when (fs/exists? target-root-dir) (fs/delete-tree target-root-dir))
377384
rewrite-clj-version (str (version/calc) "-canary")]
378385
(status/line :detail (format "Requested libs: %s" (into [] (map :name requested-libs))))
379386
(install-local rewrite-clj-version)
387+
(prep-target target-root-dir)
380388
(let [results (doall (map #(test-lib (assoc %
381389
:target-root-dir target-root-dir
382390
:rewrite-clj-version rewrite-clj-version))

0 commit comments

Comments
 (0)