From c4c798c139daf0f178f93565f348720c57c1a93c Mon Sep 17 00:00:00 2001 From: Cam Hutchison Date: Thu, 18 Aug 2022 16:28:33 +1000 Subject: [PATCH] build: Ignore staged changes on up-to-date check Have `make check-uptodate` ignore staged changes so you can run `make ci` with all your changes staged to verify all is good before committing. The `check-uptodate` target leaves files dirty in the workspace so this change should not alter the original desired behaviour. `git status --porcelain` outputs a non-space character as the first character on a line for staged changes, unless it is `?` which means untracked. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 57f60a2..3da68ea 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ cover: test ## Show test coverage in your browser check-uptodate: proto go mod tidy - test -z "$$(git status --porcelain)" || { git diff; false; } + test -z "$$(git status --porcelain | grep '^[ ?]')" || { git diff; false; } CHECK_COVERAGE = awk -F '[ \t%]+' '/^total:/ {print; if ($$3 < $(COVERAGE)) exit 1}' FAIL_COVERAGE = { echo '$(COLOUR_RED)FAIL - Coverage below $(COVERAGE)%$(COLOUR_NORMAL)'; exit 1; }