summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2017-09-08 22:29:27 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2017-09-08 22:35:36 +0200
commit8ab3106f6bd4967f145aeefdebe50a776c18c7b9 (patch)
tree2db1d62ff93248922399795f8d1203487db189fb
parent2fe9c7efcee3812d46f367d3321c924ca4152485 (diff)
downloadcalcurse-8ab3106f6bd4967f145aeefdebe50a776c18c7b9.tar.gz
calcurse-8ab3106f6bd4967f145aeefdebe50a776c18c7b9.zip
git-version-gen: Add default version
Instead of bailing out early in the build process when neither a version file nor a valid Git repository is detected, use a hardcoded default version string. This fixes building from shallow clones or Git snapshots. Also fixes GitHub issue #22. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
-rwxr-xr-xbuild-aux/git-version-gen12
1 files changed, 4 insertions, 8 deletions
diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 6ef7760..bf4230a 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -6,6 +6,7 @@ then
exit 1
fi
+DEF_VER=4.2.2.dev
VERFILE="$1"
if [ -d '.git' ]
@@ -13,14 +14,9 @@ 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" ] && printf "%s" "$VERSION" > "$VERFILE"
+ [ -n "$VERSION" ] && printf "%s" "$VERSION" >"$VERFILE"
fi
-if [ -f "$VERFILE" ]
-then
- cat "$VERFILE"
-else
- echo "git-version-gen: unknown version number." >&2
- exit 1
-fi
+[ -f "$VERFILE" ] || printf "%s" "$DEF_VER" >"$VERFILE"
+cat "$VERFILE"