From ee0b4bd0b331b14d23386a858ef4c5262be597cd Mon Sep 17 00:00:00 2001 From: Dominik Menke Date: Wed, 17 Mar 2021 02:27:37 +0100 Subject: [PATCH] make: fix validate-docs (#1376) --- Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0e752877..9ad13e5b 100644 --- a/Makefile +++ b/Makefile @@ -72,10 +72,12 @@ generate-dns: go generate ./... validate-doc: generate-dns -ifneq ($(shell git status --porcelain -- ./docs/ ./cmd/ 2>/dev/null),) - @echo 'The documentation must be regenerated, please use `make generate-dns`.' - @git status --porcelain -- ./docs/ ./cmd/ 2>/dev/null - @exit 2 -else - @echo 'All documentation changes are done the right way.' -endif +validate-doc: DOC_DIRECTORIES := ./docs/ ./cmd/ +validate-doc: + if git diff --exit-code --quiet $(DOC_DIRECTORIES) 2>/dev/null; then \ + echo 'All documentation changes are done the right way.'; \ + else \ + echo 'The documentation must be regenerated, please use `make generate-dns`.'; \ + git status --porcelain -- $(DOC_DIRECTORIES) 2>/dev/null; \ + exit 2; \ + fi