From: John Ellson Date: Sun, 17 May 2015 14:57:09 +0000 (-0400) Subject: use time of last git commit for version time X-Git-Tag: TRAVIS_CI_BUILD_EXPERIMENTAL~114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff14e5bcf5c3fc644f616b9da066ea703c81ccf0;p=graphviz use time of last git commit for version time --- diff --git a/autogen.sh b/autogen.sh index 27db14172..764823cae 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,7 +1,14 @@ #! /bin/sh -# Use "now" if we can't get time of last commit -GRAPHVIZ_VERSION_DATE=$( date -u +%Y%m%d.%H%M ) +GRAPHVIZ_VERSION_DATE=$( git log -n 1 --format=%ct ) +if test $? -eq 0; then + GRAPHVIZ_VERSION_DATE=$( date -u +%Y%m%d.%H%M -d @$GRAPHVIZ_VERSION_DATE ) + echo "Version date is based on time of last commit: $GRAPHVIZ_VERSION_DATE" +else + GRAPHVIZ_VERSION_DATE=$( date -u +%Y%m%d.%H%M ) + echo "Warning: we do not appear to be running in a git clone." + echo "Version date is based on time now: $GRAPHVIZ_VERSION_DATE" +fi # initialize version for a "stable" build cat >./version.m4 <