test/update-policy.sh: check that other staged changes stay out of the commit
check / check (push) Successful in 12s

The script commits only the listed paths, but no test staged anything
else, so dropping the pathspec from its git commit left the tests green
while the commit swept in whatever the person had staged. The first
scenario now stages a change to README.md and checks that the commit
holds only the listed files and that the change is still staged.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-18 21:44:44 +00:00
1 parent 6378311ac5
commit d8a4a2733a
1 file changed
+4 -1
+4 -1
View File
@@ -51,6 +51,8 @@ new_repo() {
new_repo "a first run writes and commits exactly the listed files"
echo stray > stray.txt
echo staged >> README.md
git add README.md
script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"
[ "$(git rev-list --count HEAD)" = 2 ] || fail "made no single commit"
[ "$(git show --name-only --format= HEAD | sort)" = \
@@ -58,7 +60,8 @@ script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"
cmp -s docs/REPO_POLICIES.md "$PROMPTS/prompts/REPO_POLICIES.md" ||
fail "REPO_POLICIES.md differs"
[ -x script/update-policy ] || fail "script not executable"
[ "$(git status --porcelain)" = "?? stray.txt" ] || fail "tree not clean"
[ "$(git status --porcelain)" = "$(printf 'M README.md\n?? stray.txt')" ] ||
fail "changed files outside the list"
scenario="a second run commits nothing"
script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"