Skip to content

Commit 16a1112

Browse files
committed
test(git): preserve the executable mode in review fixtures
The review preview compares the merge base against the working tree. Setting only the index executable bit leaves the file unchanged on POSIX, so the mode-only fixture disappears from that comparison. Set the working-tree mode as well and report missing preview files directly. All 113 Git driver tests pass with the corrected fixture.
1 parent ec0ce17 commit 16a1112

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎apps/server/src/vcs/GitVcsDriverCore.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,12 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
15951595
}
15961596
yield* git(cwd, ["add", "."]);
15971597
yield* git(cwd, ["update-index", "--chmod=+x", "mode-only.sh"]);
1598+
if ((yield* HostProcessPlatform) !== "win32") {
1599+
const fileSystem = yield* FileSystem.FileSystem;
1600+
const path = yield* Path.Path;
1601+
// The preview compares the merge base with the working tree, including its mode.
1602+
yield* fileSystem.chmod(path.join(cwd, "mode-only.sh"), 0o755);
1603+
}
15981604
yield* git(cwd, ["commit", "-m", "rename and add files"]);
15991605
const preview = yield* driver.getReviewDiffPreview({
16001606
cwd,
@@ -1603,6 +1609,10 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
16031609
const branch = preview.sources.find((source) => source.kind === "branch-range")!;
16041610
for (const path of ["renamed.md", "[literal].txt", " leading.txt", "mode-only.sh"]) {
16051611
const stat = branch.files!.find((file) => file.path === path)!;
1612+
assert.isDefined(
1613+
stat,
1614+
`Missing ${JSON.stringify(path)} in ${JSON.stringify(branch.files)}`,
1615+
);
16061616
const request = yield* Schema.decodeEffect(ReviewDiffPreviewInput)({
16071617
cwd,
16081618
baseRef: initialBranch,

0 commit comments

Comments
 (0)