From e13803043aa507187ab17b5c74d8a35e34e654d5 Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Fri, 8 Sep 2017 16:17:57 -0700 Subject: [PATCH] version: Add -dirty if compiled binary includes uncommited changes Signed-off-by: Mrunal Patel --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8c21e145..f4a9fae3 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,8 @@ BUILDTAGS ?= selinux seccomp $(shell hack/btrfs_tag.sh) $(shell hack/libdm_tag.s BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions SELINUXOPT ?= $(shell test -x /usr/sbin/selinuxenabled && selinuxenabled && echo -Z) -GIT_COMMIT := $(shell git rev-parse --short HEAD) +COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true) +GIT_COMMIT := $(if $(shell git status --porcelain --untracked-files=no),"${COMMIT_NO}-dirty","${COMMIT_NO}") BUILD_INFO := $(shell date +%s) VERSION := ${shell cat ./VERSION}