LUCENE-6938: Improve output of Git Hash if no GIT available or no GIT checkout (this restores previous behaviour)

This commit is contained in:
Uwe Schindler 2016-01-24 00:03:25 +01:00 committed by Dawid Weiss
parent 7f41c65ae9
commit b18d2b3330
1 changed files with 11 additions and 2 deletions

View File

@ -608,13 +608,22 @@
<attribute name="manifest.file" default="${manifest.file}"/> <attribute name="manifest.file" default="${manifest.file}"/>
<element name="additional-manifest-attributes" optional="true"/> <element name="additional-manifest-attributes" optional="true"/>
<sequential> <sequential>
<exec dir="." executable="${git.exe}" outputproperty="checkoutid" failifexecutionfails="false"> <local name="-checkoutid"/>
<local name="-giterr"/>
<local name="checkoutid"/>
<!-- If possible, include the GIT hash into manifest: -->
<exec dir="." executable="${git.exe}" outputproperty="-checkoutid" errorproperty="-giterr" failifexecutionfails="false">
<arg value="log"/> <arg value="log"/>
<arg value="--format='%H'"/> <arg value="--format=%H"/>
<arg value="-n"/> <arg value="-n"/>
<arg value="1"/> <arg value="1"/>
</exec> </exec>
<condition property="checkoutid" value="${-checkoutid}" else="unknown">
<matches pattern="^[0-9a-z]+$" string="${-checkoutid}" casesensitive="false" multiline="true"/>
</condition>
<!-- create manifest: -->
<manifest file="@{manifest.file}"> <manifest file="@{manifest.file}">
<!-- <!--
http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#JAR%20Manifest http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#JAR%20Manifest