Add git clone utility function

This commit is contained in:
Emma 2024-08-04 08:46:17 -04:00
parent cbce6a8cb8
commit 41a92088f8

12
tools/util/git.fnl Normal file
View File

@ -0,0 +1,12 @@
(local {: sh} (require :tools.util.sh))
(fn clone [location url ?tag]
"Clones a git repository, given a location, url, and optional tag."
(assert location "Expected file location to clone git repository into.")
(assert url "Expected git repository url to clone.")
(if ?tag
(sh :git :clone :-c :advice.detachedHead=false :--depth=1 :--branch ?tag
url location)
(sh :git :clone :-c :advice.detachedHead=false :--depth=1 url location)))
{: clone}