calcurse-edge/build-aux/git-version-gen
Lukas Fleischer ee369c596f build-aux/git-version-gen: Ignore timestamps.
Do not declare the working tree dirty if only a timestamp has changed.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2011-05-24 11:46:34 +02:00

27 lines
466 B
Bash
Executable File

#!/bin/sh
if [ "$#" -ne 1 ]
then
echo "usage: git-version-gen <verfile>" >&2
exit 1
fi
VERFILE="$1"
if [ -d '.git' ]
then
git update-index --refresh > /dev/null 2>&1
VERSION=`git describe --abbrev=4 --match='v[0-9]*' --dirty 2>/dev/null`
VERSION=`echo "$VERSION" | sed 's/^v//'`
[ -n "$VERSION" ] && echo -n "$VERSION" > "$VERFILE"
fi
if [ -f "$VERFILE" ]
then
cat "$VERFILE"
else
echo "git-version-gen: unknown version number." >&2
exit 1
fi