summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/get-scala-revision13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/get-scala-revision b/tools/get-scala-revision
index eac512a010..8441b29070 100755
--- a/tools/get-scala-revision
+++ b/tools/get-scala-revision
@@ -10,12 +10,21 @@
[[ $# -eq 0 ]] || cd "$1"
+ensure_tag () {
+ # v2.10.0-M1
+ fallback=58cb15c40d
+ [[ -n $(git tag -l v2.10.0-M1) ]] || {
+ git tag -a -m "generated by get-scala-revision" v2.10.0-M1 $fallback
+ }
+}
+ensure_tag
+
# the closest tag, obtained separately because we have to
# reconstruct the string around the padded distance.
-tag=$(git describe --abbrev=0)
+tag=$(git describe --match 'v2*' --abbrev=0)
# the full string - padding correctness depends on abbrev=10.
-described=$(git describe --abbrev=10 --always --tags)
+described=$(git describe --match 'v2*' --abbrev=10)
suffix="${described##${tag}-}"
counter=$(echo $suffix | cut -d - -f 1)
hash=$(echo $suffix | cut -d - -f 2)