Skip to content

Commit

Permalink
Merge pull request #639 from stormqueen1990/feat/support-subrecurse-m…
Browse files Browse the repository at this point in the history
…odules

feat: support --recurse-submodules in git clone
  • Loading branch information
imjasonh authored Aug 30, 2023
2 parents 6ee9300 + 191b6fc commit 8d8924e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/build/pipelines/git-checkout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,22 @@ inputs:
description: |
The expected commit hash
recurse-submodules:
description: |
Indicates whether --recurse-submodules should be passed to git clone.
default: false

pipeline:
- runs: |
if [ -z "${{inputs.branch}}" ] && [ -z "${{inputs.tag}}" ]; then
echo "Warning (git-checkout): you have not specified a branch or tag."
fi
git_clone_flags=""
if [ "${{inputs.recurse-submodules}}" == "true" ]; then
git_clone_flags="--recurse-submodules"
fi
[ -n '${{inputs.branch}}' ] && clone_target='--branch ${{inputs.branch}}'
[ -n '${{inputs.tag}}' ] && clone_target='--branch ${{inputs.tag}}'
Expand All @@ -47,7 +57,7 @@ pipeline:
git config --global --add safe.directory $workdir
git config --global --add safe.directory $clone_fullpath
git clone $clone_target --depth '${{inputs.depth}}' '${{inputs.repository}}' $workdir
git clone $git_clone_flags $clone_target --depth '${{inputs.depth}}' '${{inputs.repository}}' $workdir
cd $workdir
tar -c . | (cd $clone_fullpath && tar -x)
Expand Down

0 comments on commit 8d8924e

Please sign in to comment.