File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ configure_credentials "$payload"
3333
3434uri=$( jq -r ' .source.uri // ""' <<< " $payload" )
3535branch=$( jq -r ' .source.branch // ""' <<< " $payload" )
36+ sparse_paths=" $( jq -r ' (.source.sparse_paths // ["."])[]' <<< " $payload" ) " # those "'s are important
3637git_config_payload=$( jq -r ' .source.git_config // []' <<< " $payload" )
3738ref=$( jq -r ' .version.ref // "HEAD"' <<< " $payload" )
3839override_branch=$( jq -r ' .version.branch // ""' <<< " $payload" )
@@ -89,15 +90,25 @@ elif [ -n "$tag_filter" ] || [ -n "$tag_regex" ] || [ "$fetch_tags" == "true" ]
8990 tagflag=" --tags"
9091fi
9192
93+ nocheckoutflag=" "
94+ if [ " $sparse_paths " != " ." ] && [ " $sparse_paths " != " " ]; then
95+ nocheckoutflag=" --no-checkout"
96+ fi
97+
9298if [ " $disable_git_lfs " == " true" ]; then
9399 # skip the fetching of LFS objects for all following git commands
94100 export GIT_LFS_SKIP_SMUDGE=1
95101fi
96102
97- git clone --single-branch $depthflag $uri $branchflag $destination $tagflag
103+ git clone --single-branch $depthflag $uri $branchflag $destination $tagflag $nocheckoutflag
98104
99105cd $destination
100106
107+ if [ " $sparse_paths " != " ." ] && [ " $sparse_paths " != " " ]; then
108+ git config core.sparseCheckout true
109+ echo " $sparse_paths " >> ./.git/info/sparse-checkout
110+ fi
111+
101112git fetch origin refs/notes/* :refs/notes/* $tagflag
102113
103114if [ " $depth " -gt 0 ]; then
You can’t perform that action at this time.
0 commit comments