From d1fd40b52add44329fd9c4d53aa6db2a50826302 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Fri, 25 Oct 2019 10:44:10 +0200 Subject: [PATCH] travis: make '--recursive' cloning configurable --- README.md | 3 +++ travis/utils.sh | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 99e4f1b..6bf66ef 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,9 @@ using `$FOO_REPONAME` else `foo` and the extension`.git`. `FOO_DEPTH=` Set the depth of the git clone operation. Use 0 for a full clone. [default: 5] +`FOO_RECURSIVE=YES/NO` Set to `NO` (or `0`) for a flat clone without +recursing into submodules. [default is including submodules: `YES`] + `FOO_DIRNAME=` Set the local directory name for the checkout. This will be always be extended by the release or branch name as `-`. [default is the slug in lower case: `foo`] diff --git a/travis/utils.sh b/travis/utils.sh index 94bfca3..bbdd6d9 100644 --- a/travis/utils.sh +++ b/travis/utils.sh @@ -77,6 +77,7 @@ update_release_local() { # $dep_REPOURL = GitHub / $dep_REPOOWNER (or $REPOOWNER or epics-modules) / $dep_REPONAME .git # $dep_VARNAME = $dep # $dep_DEPTH = 5 +# $dep_RECURSIVE = 1/YES (0/NO to for a flat clone) # - Add $dep_VARNAME line to the RELEASE.local file in the cache area (unless already there) # - Add full path to $modules_to_compile add_dependency() { @@ -88,6 +89,9 @@ add_dependency() { eval reponame=\${${DEP}_REPONAME:=${dep_lc}} eval repourl=\${${DEP}_REPOURL:="https://github.com/\${${DEP}_REPOOWNER:=${REPOOWNER:-epics-modules}}/${reponame}.git"} eval varname=\${${DEP}_VARNAME:=${DEP}} + eval recursive=\${${DEP}_RECURSIVE:=1} + recursive=$(echo $recursive | tr 'A-Z' 'a-z') + [ "$recursive" != "0" -a "$recursive" != "no" ] && recurse="--recursive" # determine if BASE points to a release or a branch git ls-remote --quiet --exit-code --tags $repourl "$TAG" && tagtype=release @@ -96,11 +100,9 @@ add_dependency() { case "${tagtype}" in "release" ) location=${CACHEDIR} - recursive="--recursive" ;; "branch" ) location=${SOURCEDIR} - recursive="" ;; * ) echo "$TAG is neither a tag nor a branch name for $DEP ($repourl)" @@ -123,7 +125,7 @@ add_dependency() { deptharg="--depth $depth" ;; esac - git clone --quiet $deptharg $recursive --branch "$TAG" $repourl $dirname-$TAG + git clone --quiet $deptharg $recurse --branch "$TAG" $repourl $dirname-$TAG ( cd $dirname-$TAG && git log -n1 ) modules_to_compile="${modules_to_compile} $location/$dirname-$TAG" # run hook