File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33set -e
44
55source $( dirname $0 ) /helpers.sh
6+
7+ it_clones_the_repo_at_the_given_tag () {
8+ local repo=$( init_repo)
9+ make_commit $repo > /dev/null
10+ make_annotated_tag $repo v1 " tag v1" > /dev/null
11+ local tag_ref=$( git -C $repo rev-parse v1^{commit})
12+
13+ local dest=$TMPDIR /destination
14+
15+ get_tags $repo v1 $dest | jq -e ' .version.tag == "v1"'
16+
17+ ! git -C $dest symbolic-ref -q HEAD
18+
19+ test " $( git -C $dest rev-parse HEAD) " = " $tag_ref "
20+ }
21+
22+ it_saves_the_tag_metadata () {
23+ local repo=$( init_repo)
24+ make_commit $repo > /dev/null
25+ make_annotated_tag $repo v1 " tag v1" > /dev/null
26+
27+ local dest=$TMPDIR /destination
28+
29+ get_tags $repo v1 $dest
30+
31+ jq -e ' any(.name == "tag" and .value == "v1")' < $dest /.git/metadata.json
32+ }
33+
34+ run it_clones_the_repo_at_the_given_tag
35+ run it_saves_the_tag_metadata
Original file line number Diff line number Diff line change @@ -1308,6 +1308,22 @@ get_branches() {
13081308 }" | ${resource_dir} /in " $dest " | tee /dev/stderr
13091309}
13101310
1311+ get_tags () {
1312+ local uri=$1
1313+ local tag=$2
1314+ local dest=$3
1315+
1316+ jq -n " {
1317+ source: {
1318+ uri: $( echo $uri | jq -R .) ,
1319+ version_type: \" tags\"
1320+ },
1321+ version: {
1322+ tag: $( echo $tag | jq -R .)
1323+ }
1324+ }" | ${resource_dir} /in " $dest " | tee /dev/stderr
1325+ }
1326+
13111327get_uri_with_all_branches () {
13121328 jq -n " {
13131329 source: {
You can’t perform that action at this time.
0 commit comments