Add git clone utility function
This commit is contained in:
parent
cbce6a8cb8
commit
41a92088f8
12
tools/util/git.fnl
Normal file
12
tools/util/git.fnl
Normal 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}
|
||||||
Loading…
Reference in New Issue
Block a user