From f9b2d8ce571e5e1eed0fcae01589651522475a07 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Thu, 7 Sep 2017 06:47:29 +0200 Subject: [PATCH] Allow to export the last commit's date for use in release tarballs to give users a hint on how old their software is. --- util/gnc-vcs-info | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/util/gnc-vcs-info b/util/gnc-vcs-info index 803d90520e..cf8298966c 100755 --- a/util/gnc-vcs-info +++ b/util/gnc-vcs-info @@ -2,9 +2,11 @@ # # Usage: # gnc-vcs-info -r +# gnc-vcs-info -d # gnc-vcs-info -t # # With -r prints the revision number to stdout and exits 0 on success +# With -d prints the commit date to stdout and exits 0 on success # With -t prints the vcs type that was detected to stdout and exits 0 # on success. # @@ -17,6 +19,7 @@ # Default string to return if not invoked properly usage="Usage: $0 -r + $0 -d $0 -t " # Print an error message and then exit @@ -49,6 +52,9 @@ then elif [ "$1" = "-r" ] then request="revision" +elif [ "$1" = "-d" ] +then + request="date" else my_die "$usage" fi @@ -108,6 +114,11 @@ then # to the PATH in Windows results in a build failure). # So for platform independence, use GIT_CMD for all [ -n "$GIT_CMD" ] || GIT_CMD=git + if [ "$request" = "date" ] + then + exec "$GIT_CMD" --git-dir "${real_gitdir}" log -1 --format=%ct + exit 0 + fi githead=`"$GIT_CMD" --git-dir "${real_gitdir}" log -1 --pretty=format:"%h" HEAD 2>/dev/null` # short hash only if test $? = 0 ; then /bin/echo -n $githead