Skip to content

Commit

Permalink
Refactor test-git-no-uncommitted-changes to independent script
Browse files Browse the repository at this point in the history
  • Loading branch information
user202729 committed Feb 17, 2025
1 parent 82a439a commit b7ae258
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-meson.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
id: check_update_meson
run: |
python3 tools/update-meson.py
make test-git-no-uncommitted-changes
./tools/test-git-no-uncommitted-changes
continue-on-error: true

- name: Show files changed by update-meson
Expand Down
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,7 @@ TEST_TARGET = $@
TEST = ./sage -t --logfile=$(TEST_LOG) $(TEST_FLAGS) --optional=$(TEST_OPTIONAL) $(TEST_FILES)

test-git-no-uncommitted-changes:
@UNCOMMITTED=$$(git status --porcelain); \
if [ -n "$$UNCOMMITTED" ]; then \
echo "Error: the git repo has uncommitted changes:"; \
echo "$$UNCOMMITTED"; \
echo; \
exit 1; \
fi
./tools/test-git-no-uncommitted-changes

test: all
@echo '### make $(TEST_TARGET): Running $(TEST)' >> $(TEST_LOG)
Expand Down
10 changes: 10 additions & 0 deletions tools/test-git-no-uncommitted-changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh
# Test that there is no uncommitted changes in the repository. Return failure if there is.
# Can also be invoked with `make test-git-no-uncommitted-changes` from top level.
UNCOMMITTED="$(git status --porcelain)";
if [ -n "$UNCOMMITTED" ]; then
echo "Error: the git repo has uncommitted changes:";
echo "$UNCOMMITTED";
echo;
exit 1;
fi

0 comments on commit b7ae258

Please sign in to comment.