diff options
author | Paul Phillips <paulp@improving.org> | 2012-02-02 16:59:04 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-02-02 16:59:39 -0800 |
commit | 7b153ed4927c171d1e219a5c1d98096f104cc0fe (patch) | |
tree | 7a585c2c7e4321bc819212791e9aaf4ed02f3f31 /tools | |
parent | b0e33f583955485fbdfa01aa741e440961fb6e2c (diff) | |
download | scala-7b153ed4927c171d1e219a5c1d98096f104cc0fe.tar.gz scala-7b153ed4927c171d1e219a5c1d98096f104cc0fe.tar.bz2 scala-7b153ed4927c171d1e219a5c1d98096f104cc0fe.zip |
Create a reference tag if none exists.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/get-scala-revision | 13 |
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) |