mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Allow to export the last commit's date
for use in release tarballs to give users a hint on how old their software is.
This commit is contained in:
parent
6b7a06fbdb
commit
f9b2d8ce57
@ -2,9 +2,11 @@
|
|||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# gnc-vcs-info -r <srcdir>
|
# gnc-vcs-info -r <srcdir>
|
||||||
|
# gnc-vcs-info -d <srcdir>
|
||||||
# gnc-vcs-info -t <srcdir>
|
# gnc-vcs-info -t <srcdir>
|
||||||
#
|
#
|
||||||
# With -r prints the revision number to stdout and exits 0 on success
|
# 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
|
# With -t prints the vcs type that was detected to stdout and exits 0
|
||||||
# on success.
|
# on success.
|
||||||
#
|
#
|
||||||
@ -17,6 +19,7 @@
|
|||||||
|
|
||||||
# Default string to return if not invoked properly
|
# Default string to return if not invoked properly
|
||||||
usage="Usage: $0 -r <srcdir>
|
usage="Usage: $0 -r <srcdir>
|
||||||
|
$0 -d <srcdir>
|
||||||
$0 -t <srcdir>"
|
$0 -t <srcdir>"
|
||||||
|
|
||||||
# Print an error message and then exit
|
# Print an error message and then exit
|
||||||
@ -49,6 +52,9 @@ then
|
|||||||
elif [ "$1" = "-r" ]
|
elif [ "$1" = "-r" ]
|
||||||
then
|
then
|
||||||
request="revision"
|
request="revision"
|
||||||
|
elif [ "$1" = "-d" ]
|
||||||
|
then
|
||||||
|
request="date"
|
||||||
else
|
else
|
||||||
my_die "$usage"
|
my_die "$usage"
|
||||||
fi
|
fi
|
||||||
@ -108,6 +114,11 @@ then
|
|||||||
# to the PATH in Windows results in a build failure).
|
# to the PATH in Windows results in a build failure).
|
||||||
# So for platform independence, use GIT_CMD for all
|
# So for platform independence, use GIT_CMD for all
|
||||||
[ -n "$GIT_CMD" ] || GIT_CMD=git
|
[ -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
|
githead=`"$GIT_CMD" --git-dir "${real_gitdir}" log -1 --pretty=format:"%h" HEAD 2>/dev/null` # short hash only
|
||||||
if test $? = 0 ; then
|
if test $? = 0 ; then
|
||||||
/bin/echo -n $githead
|
/bin/echo -n $githead
|
||||||
|
Loading…
Reference in New Issue
Block a user