File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515cd " $destination "
1616
17+ # git fetch exits 1 when the refspec matches no refs, so short-circuit
18+ # when the remote has no tags.
19+ if [[ -z " $( git ls-remote --tags " $uri " ) " ]]; then
20+ echo ' []' >&3
21+ exit 0
22+ fi
23+
1724git fetch --depth=1 \
1825 --filter=tree:0 \
1926 --no-tags \
6673if [[ " $sorted " == " false" ]]; then
6774 sorted_tags=$filtered_tags
6875fi
69- sorted_tags=$( echo " $sorted_tags " | grep -v ' ^[[:space:]]*$' )
7076
71- jtags=$( echo " $sorted_tags " | jq -Rn \
77+ jtags=$( printf ' %s ' " $sorted_tags " | jq -Rn \
7278 --arg prevtag " $prev_tag " \
7379 ' [inputs | (./"\t") | {tag: .[0], ref: .[1]}] | .[(map(.tag) | index($prevtag)):]' )
7480
Original file line number Diff line number Diff line change @@ -79,10 +79,25 @@ it_returns_new_tags() {
7979 | jq -e ' map(.tag) == ["v1.2.0","v1.2.1"]'
8080}
8181
82+ it_finds_no_tags () {
83+ local repo=$( init_repo)
84+
85+ check_uri_with_tags $repo | jq -e ' . == []'
86+ }
87+
88+ it_returns_no_tags_due_to_filtering () {
89+ local repo=$( init_repo)
90+ make_annotated_tag $repo foo-1 " tag foo-1" true > /dev/null
91+
92+ check_uri_with_tags_filter $repo " nomatch*" | jq -e ' . == []'
93+ }
94+
8295run it_gets_all_tags
8396run it_uses_tag_filter
8497run it_uses_tag_filters
8598run it_combines_tag_filter_and_tag_filters
8699run it_uses_tag_regex
87100run it_sorts_by_semver
88101run it_returns_new_tags
102+ run it_finds_no_tags
103+ run it_returns_no_tags_due_to_filtering
You can’t perform that action at this time.
0 commit comments