You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2021/03/10 10:03:43 UTC

[lucene] 06/18: LUCENE-6938: Improve output of Git Hash if no GIT available or no GIT checkout (this restores previous behaviour)

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch branch_5_4
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit d4a8bbbf2b1effc2f166530fcd4720127eafc9a9
Author: Uwe Schindler <us...@apache.org>
AuthorDate: Sun Jan 24 00:03:25 2016 +0100

    LUCENE-6938: Improve output of Git Hash if no GIT available or no GIT checkout (this restores previous behaviour)
---
 lucene/common-build.xml | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index d6167c1..890a50b 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -632,13 +632,22 @@
     <attribute name="manifest.file" default="${manifest.file}"/>
     <element name="additional-manifest-attributes" optional="true"/>
     <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="--format='%H'"/>
+        <arg value="--format=%H"/>
         <arg value="-n"/>
         <arg value="1"/>
       </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}">
         <!--
         http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#JAR%20Manifest