Skip to content

Commit

Permalink
build: Ignore staged changes on up-to-date check
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
camh- committed Aug 18, 2022
1 parent 7debe62 commit c4c798c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down

0 comments on commit c4c798c

Please sign in to comment.