From 41a92088f84023778d0249fc892b2bef6e15dbe9 Mon Sep 17 00:00:00 2001 From: Emma Date: Sun, 4 Aug 2024 08:46:17 -0400 Subject: [PATCH] Add git clone utility function --- tools/util/git.fnl | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tools/util/git.fnl diff --git a/tools/util/git.fnl b/tools/util/git.fnl new file mode 100644 index 0000000..ebc9727 --- /dev/null +++ b/tools/util/git.fnl @@ -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}