Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions apps/server/src/vcs/gitIndexStat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const makeCopiedCheckout = Effect.acquireRelease(
NodeFS.mkdirSync(NodePath.join(repo, "nested"));
NodeFS.writeFileSync(NodePath.join(repo, "a.txt"), "alpha\n");
NodeFS.writeFileSync(NodePath.join(repo, "nested", "b.txt"), "beta\n");
NodeFS.writeFileSync(NodePath.join(repo, "\uFEFFconfig.ts"), "export {};\n");
NodeFS.writeFileSync(NodePath.join(repo, "run.sh"), "#!/bin/sh\n", { mode: 0o755 });
NodeFS.symlinkSync("a.txt", NodePath.join(repo, "link"));
git(repo, ["add", "."]);
Expand All @@ -45,7 +46,7 @@ const makeCopiedCheckout = Effect.acquireRelease(
env,
);
// Old mtimes keep every entry clear of Git's racy-clean re-read.
for (const name of ["a.txt", "nested/b.txt", "run.sh", ".gitattributes"]) {
for (const name of ["a.txt", "nested/b.txt", "run.sh", ".gitattributes", "\uFEFFconfig.ts"]) {
NodeFS.utimesSync(NodePath.join(source, name), 1_000_000, 1_000_000);
}
git(
Expand Down Expand Up @@ -79,7 +80,14 @@ describe.skipIf(!symlinksSupported)("restatIndex", () => {
const parsed = parseIndex(NodeFS.readFileSync(sourceIndex));
assert.isNotNull(parsed);
const paths = parsed!.entries.map((entry) => entry.path);
assert.deepStrictEqual(paths, [".gitattributes", "a.txt", "link", "nested/b.txt", "run.sh"]);
assert.deepStrictEqual(paths, [
".gitattributes",
"a.txt",
"link",
"nested/b.txt",
"run.sh",
"\uFEFFconfig.ts",
]);

const restated = restatIndex(parsed!, statAll(copy, paths), { verify: true });
assert.isNotNull(restated);
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/vcs/gitIndexStat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const EXTENDED_SKIP_WORKTREE = 0x4000;
// Extensions that let Git trust an entry without checking the file, or that point at another index.
const UNSAFE_EXTENSIONS = new Set(["link", "FSMN", "sdir", "UNTR"]);

const decoder = new TextDecoder();
const decoder = new TextDecoder("utf-8", { ignoreBOM: true });

/**
* Reads a SHA-1 index that T3 wrote itself (versions 2 and 3). Anything else, including
Expand Down
Loading