Skip to content

Commit 7b153ed

Browse files
committed
Create a reference tag if none exists.
1 parent b0e33f5 commit 7b153ed

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tools/get-scala-revision

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,21 @@
1010

1111
[[ $# -eq 0 ]] || cd "$1"
1212

13+
ensure_tag () {
14+
# v2.10.0-M1
15+
fallback=58cb15c40d
16+
[[ -n $(git tag -l v2.10.0-M1) ]] || {
17+
git tag -a -m "generated by get-scala-revision" v2.10.0-M1 $fallback
18+
}
19+
}
20+
ensure_tag
21+
1322
# the closest tag, obtained separately because we have to
1423
# reconstruct the string around the padded distance.
15-
tag=$(git describe --abbrev=0)
24+
tag=$(git describe --match 'v2*' --abbrev=0)
1625

1726
# the full string - padding correctness depends on abbrev=10.
18-
described=$(git describe --abbrev=10 --always --tags)
27+
described=$(git describe --match 'v2*' --abbrev=10)
1928
suffix="${described##${tag}-}"
2029
counter=$(echo $suffix | cut -d - -f 1)
2130
hash=$(echo $suffix | cut -d - -f 2)

0 commit comments

Comments
 (0)