From 13cd21d9f1b62456f84aa995a9b4e5b203bf657c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 19 Apr 2022 10:50:19 -0400 Subject: Makefile: Quiet errors from git describe With new git versions, it is an error to invoke git inside a repository owned by someone else. This manifested as $ sudo make install fatal: unsafe repository ('/home/tavianator/code/bfs' is owned by someone else) To add an exception for this directory, call: git config --global --add safe.directory /home/tavianator/code/bfs Work around it with `2>/dev/null`. This should also help if git is not installed, but .git/ still exists. Link: https://github.blog/2022-04-12-git-security-vulnerability-announced/ --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e9a32a9..a6e7363 100644 --- a/Makefile +++ b/Makefile @@ -14,10 +14,12 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # ############################################################################ -ifeq ($(wildcard .git),) +ifneq ($(wildcard .git),) +VERSION := $(shell git describe --always 2>/dev/null) +endif + +ifndef VERSION VERSION := 2.5 -else -VERSION := $(shell git describe --always) endif ifndef OS -- cgit v1.2.3