unstableGitUpdater: add deepClone argument for non shallow clones

This commit is contained in:
Jacob Moody 2023-07-16 22:48:26 -05:00
parent db097eb3b5
commit 5dde2776d3

View File

@ -12,6 +12,7 @@
, branch ? null , branch ? null
, stableVersion ? false # Use version format according to RFC 107 (i.e. LAST_TAG+date=YYYY-MM-DD) , stableVersion ? false # Use version format according to RFC 107 (i.e. LAST_TAG+date=YYYY-MM-DD)
, tagPrefix ? "" # strip this prefix from a tag name when using stable version , tagPrefix ? "" # strip this prefix from a tag name when using stable version
, shallowClone ? true
}: }:
let let
@ -22,6 +23,7 @@ let
branch="" branch=""
use_stable_version="" use_stable_version=""
tag_prefix="" tag_prefix=""
shallow_clone=""
while (( $# > 0 )); do while (( $# > 0 )); do
flag="$1" flag="$1"
@ -39,6 +41,9 @@ let
--tag-prefix=*) --tag-prefix=*)
tag_prefix="''${flag#*=}" tag_prefix="''${flag#*=}"
;; ;;
--shallow-clone)
shallow_clone=1
;;
*) *)
echo "$0: unknown option ''${flag}" echo "$0: unknown option ''${flag}"
exit 1 exit 1
@ -58,9 +63,12 @@ let
cloneArgs=( cloneArgs=(
--bare --bare
--depth=1
) )
if [[ "$shallow_clone" == "1" ]]; then
cloneArgs+=(--depth=1)
fi
if [[ -n "$branch" ]]; then if [[ -n "$branch" ]]; then
cloneArgs+=(--branch="$branch") cloneArgs+=(--branch="$branch")
fi fi
@ -101,7 +109,8 @@ let
--rev="$commit_sha" --rev="$commit_sha"
''; '';
in [ in
[
updateScript updateScript
"--url=${builtins.toString url}" "--url=${builtins.toString url}"
] ++ lib.optionals (branch != null) [ ] ++ lib.optionals (branch != null) [
@ -109,4 +118,6 @@ in [
] ++ lib.optionals stableVersion [ ] ++ lib.optionals stableVersion [
"--use-stable-version" "--use-stable-version"
"--tag-prefix=${tagPrefix}" "--tag-prefix=${tagPrefix}"
] ++ lib.optionals shallowClone [
"--shallow-clone"
] ]