fix(git): treat selected commit paths literally (#3998)

This commit is contained in:
Eric Tsai authored and GitHub committed 2026-07-17 11:14:29 +00:00
1 parent 1f2797325b
commit 58302b2010
2 files changed
+19

No files matched your search

@@ -620,6 +620,24 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
assert.notInclude(status, "a.txt");
}),
);
it.effect("treats selected file paths literally", () =>
Effect.gen(function* () {
const cwd = yield* makeTmpDir();
yield* initRepoWithCommit(cwd);
const driver = yield* GitVcsDriver.GitVcsDriver;
yield* writeTextFile(cwd, "selected[1].txt", "literal\n");
yield* writeTextFile(cwd, "selected1.txt", "pattern match\n");
yield* driver.prepareCommitContext(cwd, ["selected[1].txt"]);
assert.equal(yield* git(cwd, ["diff", "--cached", "--name-only"]), "selected[1].txt");
const status = yield* git(cwd, ["status", "--porcelain"]);
assert.include(status, "?? selected1.txt");
}),
);
});
describe("remote operations", () => {
+1
View File
@@ -1524,6 +1524,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
}),
);
yield* runGit("GitVcsDriver.prepareCommitContext.addSelected", cwd, [
"--literal-pathspecs",
"add",
"-A",
"--",