File tree Expand file tree Collapse file tree 4 files changed +12
-53
lines changed
Expand file tree Collapse file tree 4 files changed +12
-53
lines changed Original file line number Diff line number Diff line change @@ -288,7 +288,9 @@ INITIALISATION
288288 <exec osfamily =" unix" executable =" tools/get-scala-commit-drift" outputproperty =" git.commit.drift" failifexecutionfails =" false" />
289289 <exec osfamily =" windows" executable =" tools/get-scala-commit-drift.bat" outputproperty =" git.commit.drift" failifexecutionfails =" false" />
290290 <!-- some default in case something went wrong getting the revision -->
291- <property name =" git.describe" value =" -unknown-" />
291+ <property name =" git.commit.drift" value =" 00000000" />
292+ <property name =" git.commit.sha" value =" unknown" />
293+ <property name =" git.commit.date" value =" unknown" />
292294
293295 <!-- We use the git describe to determine the OSGi modifier for our build. -->
294296 <property
@@ -332,6 +334,8 @@ INITIALISATION
332334 <echo message =" java args: ${ env.ANT_OPTS } ${ jvm.opts } " />
333335 <echo message =" javac args: ${ javac.args } " />
334336 <echo message =" scalac args: ${ scalac.args } " />
337+ <echo message =" git hash: ${ git.commit.sha } " />
338+ <echo message =" git drift: ${ git.commit.drift } " />
335339 <echo message =" maven version: ${ maven.version.number } " />
336340 <echo message =" OSGi version: ${ osgi.version.number } " />
337341 <echo message =" canonical version: ${ version.number } " />
Original file line number Diff line number Diff line change 1111
1212[[ $# -eq 0 ]] || cd " $1 "
1313
14- ensure_tag () {
15- sha=$1
16- rev=$2
17-
18- [[ -n $( git tag -l $rev ) ]] || {
19- git tag -a -m " generated by get-scala-revision" $rev $sha
20- }
21- }
22-
23- # Ensure some baseline tags are present so if this repository's
24- # tags are screwed up or stale, we should still have a reference
25- # point for a build string.
26- ensure_tag 58cb15c40d v2.10.0-M1
27- ensure_tag 29f3eace1e v2.9.1
28- ensure_tag b0d78f6b9c v2.8.2
29-
30- # the closest tag, obtained separately because we have to
31- # reconstruct the string around the padded distance.
32- tag=$( git describe --tags --match ' v2*' --abbrev=0)
33-
34- # printf %016s is not portable for 0-padding, has to be a digit.
35- # so we're stuck disassembling it.
36- described=$( git describe --tags --match ' v2*' --abbrev=10)
37- suffix=" ${described## ${tag} -} "
38- counter=$( echo $suffix | cut -d - -f 1)
39-
40- echo " $counter "
14+ # git describe is completely useles to us if we're on a tag, or haven't changed since then.
15+ # This at least gives us a total number of commits included in a release, which should grow steadily.
16+ counter=$( git shortlog | grep -E ' ^[ ]+\w+' | wc -l)
17+ printf " %08d" " $counter "
Original file line number Diff line number Diff line change 1010
1111[[ $# -eq 0 ]] || cd " $1 "
1212
13- ensure_tag () {
14- sha=$1
15- rev=$2
16-
17- [[ -n $( git tag -l $rev ) ]] || {
18- git tag -a -m " generated by get-scala-revision" $rev $sha
19- }
20- }
21-
22- # Ensure some baseline tags are present so if this repository's
23- # tags are screwed up or stale, we should still have a reference
24- # point for a build string.
25- ensure_tag 58cb15c40d v2.10.0-M1
26- ensure_tag 29f3eace1e v2.9.1
27- ensure_tag b0d78f6b9c v2.8.2
28-
29- # the closest tag, obtained separately because we have to
30- # reconstruct the string around the padded distance.
31- tag=$( git describe --tags --match ' v2*' --abbrev=0)
32-
3313# printf %016s is not portable for 0-padding, has to be a digit.
3414# so we're stuck disassembling it.
35- described=$( git describe --tags --match ' v2*' --abbrev=10)
36- suffix=" ${described## ${tag} -} "
37- hash=$( echo $suffix | cut -d - -f 2)
15+ hash=$( git log -1 --format=" %H" HEAD)
3816hash=${hash# g}
39-
17+ hash= ${hash : 0 : 10}
4018echo " $hash "
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ if "%*"=="" (
1515cd %_DIR%
1616
1717rem TODO - truncate chars.
18- git log -1 --format=" %T "
18+ git log -1 --format=" %H
1919
2020:end
2121@ endlocal
You can’t perform that action at this time.
0 commit comments