@@ -20,7 +20,7 @@ it_can_put_to_url() {
2020 git -C $repo1 checkout refs/heads/master
2121
2222 put_uri $repo1 $src repo | jq -e "
23- .version == {ref: $( echo $ref | jq -R .) }
23+ .version == {ref: $( echo $ref :master | jq -R .) }
2424 "
2525
2626 # switch back to master
@@ -46,7 +46,7 @@ it_can_put_to_url_with_tag() {
4646 git -C $repo1 checkout refs/heads/master
4747
4848 put_uri_with_tag $repo1 $src some-tag-file repo | jq -e "
49- .version == {ref: $( echo $ref | jq -R .) }
49+ .version == {ref: $( echo $ref :master | jq -R .) }
5050 "
5151
5252 # switch back to master
@@ -72,7 +72,7 @@ it_can_put_to_url_with_tag_and_prefix() {
7272 git -C $repo1 checkout refs/heads/master
7373
7474 put_uri_with_tag_and_prefix $repo1 $src some-tag-file v repo | jq -e "
75- .version == {ref: $( echo $ref | jq -R .) }
75+ .version == {ref: $( echo $ref :master | jq -R .) }
7676 "
7777
7878 # switch back to master
@@ -105,7 +105,7 @@ it_can_put_to_url_with_rebase() {
105105 local rebased_ref=$( git -C $repo2 rev-parse HEAD)
106106
107107 jq -e "
108- .version == {ref: $( echo $rebased_ref | jq -R .) }
108+ .version == {ref: $( echo $rebased_ref :master | jq -R .) }
109109 " < $response
110110
111111 # switch back to master
@@ -139,7 +139,7 @@ it_can_put_to_url_with_rebase_with_tag() {
139139 local rebased_ref=$( git -C $repo2 rev-parse HEAD)
140140
141141 jq -e "
142- .version == {ref: $( echo $rebased_ref | jq -R .) }
142+ .version == {ref: $( echo $rebased_ref :master | jq -R .) }
143143 " < $response
144144
145145 # switch back to master
@@ -174,7 +174,7 @@ it_can_put_to_url_with_rebase_with_tag_and_prefix() {
174174 local rebased_ref=$( git -C $repo2 rev-parse HEAD)
175175
176176 jq -e "
177- .version == {ref: $( echo $rebased_ref | jq -R .) }
177+ .version == {ref: $( echo $rebased_ref :master | jq -R .) }
178178 " < $response
179179
180180 # switch back to master
@@ -201,7 +201,7 @@ it_can_put_to_url_with_only_tag() {
201201 git -C $repo1 checkout refs/heads/master
202202
203203 put_uri_with_only_tag $repo1 $src repo | jq -e "
204- .version == {ref: $( echo $ref | jq -R .) }
204+ .version == {ref: $( echo $ref :master | jq -R .) }
205205 "
206206
207207 # switch back to master
@@ -212,10 +212,40 @@ it_can_put_to_url_with_only_tag() {
212212 test " $( git -C $repo1 rev-parse some-only-tag) " = $ref
213213}
214214
215+ it_can_put_to_url_when_multibranch () {
216+ local repo=$( init_repo)
217+ local ref1=$( make_commit $repo )
218+ local ref2=$( make_commit $repo )
219+ local ref3=$( make_commit_to_file_on_branch $repo some-other-file branch-a)
220+ local ref4=$( make_commit $repo )
221+
222+ git -C $repo checkout refs/heads/master
223+
224+ local dest=$TMPDIR /destination
225+
226+ test_get $dest uri $repo ref " $ref3 :branch-a $ref2 :master" | jq -e "
227+ .version == {ref: $( echo " $ref3 :branch-a $ref2 :master" | jq -R .) }
228+ "
229+
230+ test -e $dest /some-other-file
231+ test " $( git -C $dest rev-parse HEAD) " = $ref3
232+ test " $( git -C $dest rev-parse branch-a) " = $ref3
233+
234+ put_uri_with_multibranch $repo $repo $dest " (branch-a)" | jq -e "
235+ .version == {ref: $( echo $ref3 :branch-a | jq -R .) }
236+ "
237+
238+ git -C $repo checkout branch-a
239+ test -e $repo /some-other-file
240+ test " $( git -C $repo rev-parse master) " = $ref4
241+ test " $( git -C $repo rev-parse branch-a) " = $ref3
242+ }
243+
215244run it_can_put_to_url
216245run it_can_put_to_url_with_tag
217246run it_can_put_to_url_with_tag_and_prefix
218247run it_can_put_to_url_with_rebase
219248run it_can_put_to_url_with_rebase_with_tag
220249run it_can_put_to_url_with_rebase_with_tag_and_prefix
221250run it_can_put_to_url_with_only_tag
251+ run it_can_put_to_url_when_multibranch
0 commit comments