Commit 95382a52 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Add a --recursive option duneci-install-module

This is needed for Dune modules that use git submodules
to initialized the submodules and potentially even their
submodules.
parent e934a7a1
...@@ -9,6 +9,7 @@ usage() { ...@@ -9,6 +9,7 @@ usage() {
echo >&2 echo >&2
echo "options:" >&2 echo "options:" >&2
echo " -b <branch>, --branch <branch>: Install branch <branch> of the module." >&2 echo " -b <branch>, --branch <branch>: Install branch <branch> of the module." >&2
echo " -r, --recursive: Clone the git repository with --recursive (for git submodules)." >&2
echo >&2 echo >&2
echo "environment variables:" >&2 echo "environment variables:" >&2
echo " DUNECI_BRANCH:" >&2 echo " DUNECI_BRANCH:" >&2
...@@ -26,6 +27,7 @@ fi ...@@ -26,6 +27,7 @@ fi
branch="${DUNECI_BRANCH:-}" branch="${DUNECI_BRANCH:-}"
recursive=0
while :; do while :; do
case "${1}" in case "${1}" in
...@@ -33,6 +35,10 @@ while :; do ...@@ -33,6 +35,10 @@ while :; do
branch="${2}" branch="${2}"
shift 2 shift 2
;; ;;
-r|--recursive)
recursive=1
shift 1
;;
*) *)
break break
;; ;;
...@@ -49,10 +55,13 @@ if [[ -d "${module}" ]]; then ...@@ -49,10 +55,13 @@ if [[ -d "${module}" ]]; then
exit 1 exit 1
fi fi
git_clone_opts=(--depth=1 --no-single-branch) git_clone_opts=(--depth=1 --no-single-branch "${recursive}")
if [[ -n "${branch}" ]]; then if [[ -n "${branch}" ]]; then
git_clone_opts+=(-b "${branch}") git_clone_opts+=(-b "${branch}")
fi fi
if [[ ${recursive} ]]; then
git_clone_opts+=("--recursive")
fi
git clone "${git_clone_opts[@]}" "${repo}" git clone "${git_clone_opts[@]}" "${repo}"
if [[ "${DUNECI_BRANCH_AUTO:-1}" = "1" && -n "${CI_BUILD_REF_NAME:-}" ]]; then if [[ "${DUNECI_BRANCH_AUTO:-1}" = "1" && -n "${CI_BUILD_REF_NAME:-}" ]]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment