summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2022-02-05 16:36:09 +0100
committerGravatar Nikias Bassen2022-02-05 16:36:09 +0100
commit7bc4d2f14e5a0bb80fd7342f954554947b9fee01 (patch)
tree57c9379f047718305d20854aad79f2bd89a07823
parentbf44ba84846ba3fcc6b7ad24e820086fa4c2d8a0 (diff)
downloadlibplist-7bc4d2f14e5a0bb80fd7342f954554947b9fee01.tar.gz
libplist-7bc4d2f14e5a0bb80fd7342f954554947b9fee01.tar.bz2
configure: Generate usable version via git-version-gen when ran in shallow clone
-rwxr-xr-xgit-version-gen6
1 files changed, 5 insertions, 1 deletions
diff --git a/git-version-gen b/git-version-gen
index b403fce..3eb6a42 100755
--- a/git-version-gen
+++ b/git-version-gen
@@ -5,7 +5,11 @@ if test -n "$1"; then
else
if test -d "${SRCDIR}/.git" && test -x "`which git`" ; then
git update-index -q --refresh
- VER=`git describe --tags --dirty=-dirty`
+ if ! VER=`git describe --tags --dirty 2>/dev/null`; then
+ COMMIT=`git rev-parse --short HEAD`
+ DIRTY=`git diff --quiet HEAD || echo "-dirty"`
+ VER=`sed -n '1,/RE/s/Version \(.*\)/\1/p' ${SRCDIR}/NEWS`-git-${COMMIT}${DIRTY}
+ fi
else
if test -f "${SRCDIR}/.tarball-version"; then
VER=`cat "${SRCDIR}/.tarball-version"`