Git tests name the repository's git dir, as the runner's cached clones do

This commit is contained in:
aiongg committed 2026-11-14 23:36:27 +00:00
1 parent 944dd7984e
commit 7baa2eff7c
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -20,7 +20,7 @@ test("the CI-fix guard judges the lines where git applies the patch, and attribu
writeFileSync(join(dir, "r", "src", "price.rs"), LIB);
const g = (...a: string[]) => execFileSync("git", ["-C", join(dir, "r"), ...a], { encoding: "utf8" }).trim();
g("add", "."); g("-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "m");
const git = new Git(exec, dir, "r");
const git = new Git(exec, dir, "r/.git");
const guard = (patch: string) => guardApplied(git, dir, "HEAD", patch, []);
const testEdit = " fn price_is_four() {\n- let expected = 4;\n+ let expected = 6;\n assert_eq!(price(), expected);\n";
// The header claims line 5, outside the test module; git places the hunk by its context, inside it.
+1 -1
View File
@@ -29,7 +29,7 @@ test("a refused patch reports the error lines of git apply, not its progress lin
writeFileSync(join(dir, "r", "a.rs"), "x\n");
g("add", "."); g("-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "m");
const patch = patchFor(".", "autocraft_regression_1", "y").replace("tests/autocraft_regression_1.rs", "a.rs").replaceAll("tests/autocraft_regression_1.rs", "a.rs");
const r = await new Git(exec, dir, "r").applyToTree("HEAD", patch, join(dir, "idx"));
const r = await new Git(exec, dir, "r/.git").applyToTree("HEAD", patch, join(dir, "idx"));
assert.ok(!r.ok);
if (!r.ok) assert.match(r.reason, /^git apply --check: a\.rs: already exists in index/);
} finally { rmSync(dir, { recursive: true, force: true }); }