Makefile: get proper git hash when directly on tag + dirty

When the current `HEAD` is tagged, and the work directory is 'dirty', the
`GITHASH` variable now contains the actual Git hash. Before this change it
would only be the word "dirty".
This commit is contained in:
Sybren A. Stüvel 2023-08-01 13:56:15 +02:00
parent 100e8e404e
commit b2c49492f1

View File

@ -18,6 +18,9 @@ _GIT_DESCRIPTION_OR_TAG := $(subst v${VERSION}-,,$(shell git describe --tag --di
# in the "extended version" of Flamenco, which combines ${VERSION} and # in the "extended version" of Flamenco, which combines ${VERSION} and
# ${GITHASH}. # ${GITHASH}.
GITHASH := $(subst v${VERSION},$(shell git rev-parse --short=9 HEAD),${_GIT_DESCRIPTION_OR_TAG}) GITHASH := $(subst v${VERSION},$(shell git rev-parse --short=9 HEAD),${_GIT_DESCRIPTION_OR_TAG})
ifeq (${GITHASH},dirty)
GITHASH := $(shell git rev-parse --short=9 HEAD)
endif
LDFLAGS := ${LDFLAGS} -X ${PKG}/internal/appinfo.ApplicationVersion=${VERSION} \ LDFLAGS := ${LDFLAGS} -X ${PKG}/internal/appinfo.ApplicationVersion=${VERSION} \
-X ${PKG}/internal/appinfo.ApplicationGitHash=${GITHASH} \ -X ${PKG}/internal/appinfo.ApplicationGitHash=${GITHASH} \