File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ configure_credentials "$payload"
33
33
34
34
uri=$( jq -r ' .source.uri // ""' <<< " $payload" )
35
35
branch=$( jq -r ' .source.branch // ""' <<< " $payload" )
36
+ sparse_paths=" $( jq -r ' (.source.sparse_paths // ["."])[]' <<< " $payload" ) " # those "'s are important
36
37
git_config_payload=$( jq -r ' .source.git_config // []' <<< " $payload" )
37
38
ref=$( jq -r ' .version.ref // "HEAD"' <<< " $payload" )
38
39
override_branch=$( jq -r ' .version.branch // ""' <<< " $payload" )
@@ -89,15 +90,25 @@ elif [ -n "$tag_filter" ] || [ -n "$tag_regex" ] || [ "$fetch_tags" == "true" ]
89
90
tagflag=" --tags"
90
91
fi
91
92
93
+ nocheckoutflag=" "
94
+ if [ " $sparse_paths " != " ." ] && [ " $sparse_paths " != " " ]; then
95
+ nocheckoutflag=" --no-checkout"
96
+ fi
97
+
92
98
if [ " $disable_git_lfs " == " true" ]; then
93
99
# skip the fetching of LFS objects for all following git commands
94
100
export GIT_LFS_SKIP_SMUDGE=1
95
101
fi
96
102
97
- git clone --single-branch $depthflag $uri $branchflag $destination $tagflag
103
+ git clone --single-branch $depthflag $uri $branchflag $destination $tagflag $nocheckoutflag
98
104
99
105
cd $destination
100
106
107
+ if [ " $sparse_paths " != " ." ] && [ " $sparse_paths " != " " ]; then
108
+ git config core.sparseCheckout true
109
+ echo " $sparse_paths " >> ./.git/info/sparse-checkout
110
+ fi
111
+
101
112
git fetch origin refs/notes/* :refs/notes/* $tagflag
102
113
103
114
if [ " $depth " -gt 0 ]; then
You can’t perform that action at this time.
0 commit comments