summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-02-02 16:59:04 -0800
committerPaul Phillips <paulp@improving.org>2012-02-02 16:59:39 -0800
commit7b153ed4927c171d1e219a5c1d98096f104cc0fe (patch)
tree7a585c2c7e4321bc819212791e9aaf4ed02f3f31 /tools
parentb0e33f583955485fbdfa01aa741e440961fb6e2c (diff)
downloadscala-7b153ed4927c171d1e219a5c1d98096f104cc0fe.tar.gz
scala-7b153ed4927c171d1e219a5c1d98096f104cc0fe.tar.bz2
scala-7b153ed4927c171d1e219a5c1d98096f104cc0fe.zip
Create a reference tag if none exists.
Diffstat (limited to 'tools')
-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)