File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,6 +91,23 @@ it_can_get_from_url_at_override_branch() {
9191 test " $( git -C $dest rev-parse HEAD) " = $ref
9292}
9393
94+ it_can_get_from_url_with_sparse_paths () {
95+ local repo=$( init_repo)
96+ local ref1=$( make_commit_to_file $repo file-a)
97+ local ref2=$( make_commit_to_file $repo file-b)
98+ local dest=$TMPDIR /destination
99+ local sparse_paths=" file-a"
100+
101+ get_uri_with_sparse $repo $dest $sparse_paths | jq -e "
102+ .version == {ref: $( echo $ref2 | jq -R .) }
103+ "
104+
105+ test -e $dest /file-a
106+ test ! -e $dest /file-b
107+
108+ test " $( git -C $dest rev-parse HEAD) " = $ref2
109+ }
110+
94111it_omits_empty_branch_in_metadata () {
95112 local repo=$( init_repo)
96113 local ref1=$( make_commit_to_branch $repo branch-a)
@@ -916,6 +933,7 @@ run it_can_get_from_url_at_ref
916933run it_can_get_from_url_at_branch
917934run it_can_get_from_url_only_single_branch
918935run it_can_get_from_url_at_override_branch
936+ run it_can_get_from_url_with_sparse_paths
919937run it_omits_empty_branch_in_metadata
920938run it_returns_branch_in_metadata
921939run it_omits_empty_tags_in_metadata
Original file line number Diff line number Diff line change @@ -1056,6 +1056,18 @@ get_uri_with_custom_timestamp() {
10561056 }" | ${resource_dir} /in " $2 " | tee /dev/stderr
10571057}
10581058
1059+ get_uri_with_sparse () {
1060+ jq -n " {
1061+ source: {
1062+ uri: $( echo $1 | jq -R .) ,
1063+ sparse_paths: $( echo " $@ " | jq -R ' . | split(" ")' )
1064+ },
1065+ params: {
1066+ short_ref_format: \" test-%s\"
1067+ }
1068+ }" | ${resource_dir} /in " $2 " | tee /dev/stderr
1069+ }
1070+
10591071put_uri () {
10601072 jq -n " {
10611073 source: {
You can’t perform that action at this time.
0 commit comments