Update get-version script
@@ -12,14 +12,17 @@ if ! git diff-files --quiet; then
DIRTY_TAG="-dirty"
fi
-# If the commit in question has a tag applied to it directly, use it.
+# If we have an exact tag, and it is not a -dev tag, just use it.
if git describe --tags --exact-match "${COMMITISH}" >/dev/null 2>&1; then
+ TAG="$(git describe --tags --exact-match "${COMMITISH}")"
+ if [[ ! "${TAG}" =~ -dev$ ]]; then
echo "$(git describe --tags --exact-match "${COMMITISH}")${DIRTY_TAG}"
exit 0
fi
+fi
-# Otherwise we don't have an exact tag, so produce one that is the
-# base tag, plus a timestamp and commit hash. We use the timestamp of
+# Otherwise we want to include some additional information. To the
+# base tag we add a timestamp and commit hash. We use the timestamp of
# the commit itself, not the date it was authored (so it will change
# when someone rebases a PR into master, for example).
echo "$(git describe --tags --abbrev=0 ${COMMITISH})-$(git show -s --format='%ct-g%h' ${COMMITISH})${DIRTY_TAG}"
