From 9f80653779933205c31afae68f46dedcdc2ad8b3 Mon Sep 17 00:00:00 2001 From: Zhang Wei Date: Sun, 4 Sep 2016 16:00:26 +0800 Subject: [PATCH] Append string "-dirty" to version if git repo is unclean If runc binary is compiled from codes with modified but not commited files, git commits should report "COMMIT-dirty" instead of single "COMMIT" to warn users. Signed-off-by: Zhang Wei --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9ce84ad7..a7c22098 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,8 @@ TEST_DOCKERFILE := script/test_Dockerfile BUILDTAGS := seccomp RUNC_BUILD_PATH := /go/src/github.com/opencontainers/runc/runc RUNC_INSTANCE := runc_dev -COMMIT := $(shell git rev-parse HEAD 2> /dev/null || true) +COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true) +COMMIT := $(if $(shell git status --porcelain --untracked-files=no),"${COMMIT_NO}-dirty","${COMMIT_NO}") RUNC_LINK := $(CURDIR)/Godeps/_workspace/src/github.com/opencontainers/runc export GOPATH := $(CURDIR)/Godeps/_workspace