Skip to content

Commit 340bb43

Browse files
committed
Tweaks to get-scala-revision.
Reference to git head is supposed to be HEAD, not head. Also apparently [[ <test> ]] is a bashism so it's [ <test> ]. Made name generation robust against the absence of the dev tag; it will generate a similar name even if it's not there, minus the part it can't determine without it.
1 parent a289465 commit 340bb43

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

tools/get-scala-revision

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@
55
#
66
# If no dir is given, current working dir is used.
77

8-
[[ -n "$1" ]] && cd "$1"
8+
[ -n "$1" ] && cd "$1"
99

1010
# dev should be a tag at the merge-base of master and the
1111
# most recent release.
12-
git describe head --abbrev=7 --match dev
12+
if [ -z $(git tag -l dev) ]; then
13+
# no dev tag available - this will generate dev-g<sha>
14+
echo "dev-g$(git describe HEAD --abbrev=7 --always)"
15+
else
16+
# dev tag exists - this generates dev-NNNN-g<sha>
17+
# where NNNN is the number of commits since dev.
18+
git describe HEAD --abbrev=7 --match dev
19+
fi

tools/get-scala-revision.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if "%*"=="" (
1515
cd %_DIR%
1616

1717
if exist .git\NUL (
18-
git describe head --abbrev=7 --match dev
18+
git describe HEAD --abbrev=7 --match dev
1919
echo 0
2020
)
2121

0 commit comments

Comments
 (0)