build: fix build when we don't have a full git tree
When building with docker, we don't have a _full_ git repo.
Steven Allen committed
Sep 4, 2019 at 13:10 UTC
77298e1e906bcbb542834f2e6bdedb1609a07b20
1 file changed
+4
-2
mk/git.mk
+4
-2
@@ -1,2 +1,4 @@
1
-git-hash:=$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null)
2
-
1
+# First try to "describe" the state. This tells us if the state is dirty.
2
+# If that fails (e.g., we're building a docker image and have an empty objects
3
+# directory), assume the source isn't dirty and build anyways.
4
+git-hash:=$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)