test/update-policy.sh: check that other staged changes stay out of the commit
check / check (push) Successful in 12s
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:
1 parent
6378311ac5
commit
d8a4a2733a
1 file changed
+4
-1
@@ -51,6 +51,8 @@ new_repo() {
|
|||||||
|
|
||||||
new_repo "a first run writes and commits exactly the listed files"
|
new_repo "a first run writes and commits exactly the listed files"
|
||||||
echo stray > stray.txt
|
echo stray > stray.txt
|
||||||
|
echo staged >> README.md
|
||||||
|
git add README.md
|
||||||
script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"
|
script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"
|
||||||
[ "$(git rev-list --count HEAD)" = 2 ] || fail "made no single commit"
|
[ "$(git rev-list --count HEAD)" = 2 ] || fail "made no single commit"
|
||||||
[ "$(git show --name-only --format= HEAD | sort)" = \
|
[ "$(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" ||
|
cmp -s docs/REPO_POLICIES.md "$PROMPTS/prompts/REPO_POLICIES.md" ||
|
||||||
fail "REPO_POLICIES.md differs"
|
fail "REPO_POLICIES.md differs"
|
||||||
[ -x script/update-policy ] || fail "script not executable"
|
[ -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"
|
scenario="a second run commits nothing"
|
||||||
script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"
|
script/update-policy > "$dir/output" 2>&1 || fail "exited non-zero"
|
||||||
|
|||||||
Reference in new issue
Block a user