Skip to content

Commit 30489a0

Browse files
committed
Add branch to the version in 'out'.
1 parent c768a58 commit 30489a0

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

assets/out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ if [ -z "$uri" ]; then
3838
exit 1
3939
fi
4040

41+
cd $source
42+
4143
if [ -z "$branch" ]; then
4244
branch=$(git -C $repository config --local concourse-ci.branch-name)
4345
fi
@@ -51,8 +53,6 @@ if [ -z "$repository" ]; then
5153
exit 1
5254
fi
5355

54-
cd $source
55-
5656
if [ -n "$tag" ] && [ ! -f "$tag" ]; then
5757
echo "tag file '$tag' does not exist"
5858
exit 1
@@ -128,6 +128,6 @@ else
128128
fi
129129

130130
jq -n "{
131-
version: {ref: $(git rev-parse HEAD | jq -R .)},
131+
version: {ref: $(echo $(git rev-parse HEAD):$branch | jq -R .)},
132132
metadata: $(git_metadata)
133133
}" >&3

test/put.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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
@@ -232,7 +232,7 @@ it_can_put_to_url_when_multibranch() {
232232
test "$(git -C $dest rev-parse branch-a)" = $ref3
233233

234234
put_uri_with_multibranch $repo $repo $dest "(branch-a)" | jq -e "
235-
.version == {ref: $(echo "$ref3" | jq -R .)}
235+
.version == {ref: $(echo $ref3:branch-a | jq -R .)}
236236
"
237237

238238
git -C $repo checkout branch-a

0 commit comments

Comments
 (0)