Correct version extraction when tags are missing

Issue: #55
This commit is contained in:
Diomidis Spinellis 2019-03-25 22:16:02 +02:00
parent e5bc6f1f8f
commit 75cc871a10
1 changed files with 5 additions and 5 deletions

View File

@ -21,12 +21,12 @@
<macrodef name="gitversion" description="Get git version."> <macrodef name="gitversion" description="Get git version.">
<attribute name="outputproperty"/> <attribute name="outputproperty"/>
<sequential> <sequential>
<echo message="git describe --abbrev=6 => '@{outputproperty}'"/> <echo message="git rev-parse --short=6 => '@{outputproperty}'"/>
<exec executable="git" <exec executable="git"
failonerror="true" failonerror="true"
outputproperty="@{outputproperty}"> outputproperty="@{outputproperty}">
<arg value="describe"/> <arg value="rev-parse"/>
<arg value="--abbrev=6"/> <arg value="--short=6"/>
<arg value="HEAD"/> <arg value="HEAD"/>
<redirector> <redirector>
<outputfilterchain> <outputfilterchain>
@ -78,8 +78,8 @@
<target name="version"> <target name="version">
<exec executable="git" <exec executable="git"
outputproperty="VERSION"> outputproperty="VERSION">
<arg value="describe"/> <arg value="rev-parse"/>
<arg value="--abbrev=6"/> <arg value="--short=6"/>
<arg value="HEAD"/> <arg value="HEAD"/>
</exec> </exec>
<echo>Version is ${VERSION}</echo> <echo>Version is ${VERSION}</echo>