From aba6c3d2f8aba08584d90866f106f4f98d324e26 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 4 Sep 2019 13:10:31 -0700 Subject: [PATCH] build: fix build when we don't have a full git tree When building with docker, we don't have a _full_ git repo. --- mk/git.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mk/git.mk b/mk/git.mk index 6f19f43deb4..a4b618e0c84 100644 --- a/mk/git.mk +++ b/mk/git.mk @@ -1,2 +1,4 @@ -git-hash:=$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null) - +# First try to "describe" the state. This tells us if the state is dirty. +# If that fails (e.g., we're building a docker image and have an empty objects +# directory), assume the source isn't dirty and build anyways. +git-hash:=$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)