authorgravatar for 52527831+EricTsai83@users.noreply.github.comEric Tsai <52527831+EricTsai83@users.noreply.github.com> 2026-07-17 19:14:29+08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-07-17 11:14:29+00:00
log58302b2010913d6e236570bbe8c9abe38de7fa18
treef47f02ff165e0477bb3c61601fe13ae8cf33ec52
parent1f2797325ba52b93fddfb5aaaee3b18c86800589
signature Signed by PGP key B5690EEEBB952194

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


2 files changed, 19 insertions(+), 0 deletions(-)

apps/server/src/vcs/GitVcsDriverCore.test.ts+18
......@@ -620,6 +620,24 @@ it.layer(TestLayer)("GitVcsDriver core integration", (it) => {
620620 assert.notInclude(status, "a.txt");
621621 }),
622622 );
623
624 it.effect("treats selected file paths literally", () =>
625 Effect.gen(function* () {
626 const cwd = yield* makeTmpDir();
627 yield* initRepoWithCommit(cwd);
628 const driver = yield* GitVcsDriver.GitVcsDriver;
629
630 yield* writeTextFile(cwd, "selected[1].txt", "literal\n");
631 yield* writeTextFile(cwd, "selected1.txt", "pattern match\n");
632
633 yield* driver.prepareCommitContext(cwd, ["selected[1].txt"]);
634
635 assert.equal(yield* git(cwd, ["diff", "--cached", "--name-only"]), "selected[1].txt");
636
637 const status = yield* git(cwd, ["status", "--porcelain"]);
638 assert.include(status, "?? selected1.txt");
639 }),
640 );
623641 });
624642
625643 describe("remote operations", () => {
apps/server/src/vcs/GitVcsDriverCore.ts+1
......@@ -1524,6 +1524,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
15241524 }),
15251525 );
15261526 yield* runGit("GitVcsDriver.prepareCommitContext.addSelected", cwd, [
1527 "--literal-pathspecs",
15271528 "add",
15281529 "-A",
15291530 "--",