@@ -850,6 +850,38 @@ it_returns_list_of_all_tags_in_metadata() {
850850 "
851851}
852852
853+ it_can_get_from_url_at_branch_with_search_remote_refs () {
854+ local repo=$( init_repo)
855+ local ref1=$( make_commit_to_branch $repo branch-a)
856+ local ref2=$( make_commit_to_branch $repo branch-a)
857+ git -C $repo update-ref refs/heads/branch-a $ref1
858+ git -C $repo update-ref refs/changes/1 $ref2
859+ git -C $repo log --all --oneline
860+ git -C $repo branch -v
861+ local dest=$TMPDIR /destination
862+
863+ # use file:// repo to force the regular git transport instead of local copying
864+ set +e
865+ output=$( get_uri_at_branch_with_ref file://$repo " branch-a" $ref2 $dest 2>&1 )
866+ exit_code=$?
867+ set -e
868+
869+ echo $output $exit_code
870+ test " ${exit_code} " = 128
871+ echo " $output " | grep " fatal: reference is not a tree: "
872+ test -e $dest /some-file
873+ test " $( git -C $dest rev-parse HEAD) " ! = $ref2
874+
875+ rm -rf $dest
876+
877+ get_uri_at_branch_with_search_remote_refs file://$repo " branch-a" $ref2 $dest | jq -e "
878+ .version == {ref: $( echo $ref2 | jq -R .) }
879+ "
880+
881+ test -e $dest /some-file
882+ test " $( git -C $dest rev-parse HEAD) " = $ref2
883+ }
884+
853885run it_can_use_submodules_with_missing_paths
854886run it_can_use_submodules_with_names_that_arent_paths
855887run it_can_use_submodules_without_perl_warning
@@ -892,3 +924,4 @@ run it_retains_tags_by_default
892924run it_retains_tags_with_clean_tags_param
893925run it_returns_list_without_tags_in_metadata
894926run it_returns_list_of_all_tags_in_metadata
927+ run it_can_get_from_url_at_branch_with_search_remote_refs
0 commit comments