Count both paths of a rename in the docs-only CI skip

This commit is contained in:
2026-08-05 10:15:09 +02:00
parent 6df90f3746
commit 81043edfc6
3 changed files with 11 additions and 4 deletions
+6 -2
View File
@@ -28,7 +28,11 @@ test("the commit-hash image is pushed even when the gate no-ops", () => {
assert.doesNotMatch(step("docker push"), /^\s*if:/m);
});
test("only *.md counts as docs, and a dirty working tree counts as changed", () => {
test("only *.md counts as docs; a dirty tree and a rename both count as changed", () => {
assert.ok(gate.includes("\\.md$"), "the non-docs match is a *.md suffix test");
assert.match(gate, /git status --porcelain/, "uncommitted code can never be skipped over");
assert.match(gate, /git status --porcelain --no-renames/, "uncommitted code can never be skipped over");
// Rename detection hides the source path: `git mv src/app.ts notes.md` reads as the .md alone
// under --name-only, and as a single `R src/app.ts -> notes.md` line under --porcelain — so
// without --no-renames a deleted source file looks like docs and skips the gate.
assert.match(gate, /git diff --name-only --no-renames/, "a rename must list both of its paths");
});