{"draft":null,"from":175,"to":318,"files":[{"path":"server/test/push.test.ts","added":44,"removed":1,"diff":"--- a/server/test/push.test.ts\n+++ b/server/test/push.test.ts\n@@ -3,8 +3,14 @@\n import git from \"isomorphic-git\";\n import { absoVersion } from \"../src/ingest.ts\";\n import { MemoryFS } from \"../src/memory-fs.ts\";\n-import { commitShared, projectOfRepo, readTreeFiles, repoName } from \"../src/push.ts\";\n+import { blobOid, commitShared, projectOfRepo, readTreeFiles, repoName } from \"../src/push.ts\";\n \n+it(\"hashes exact Git blob bytes including a nonzero buffer offset\", async () => {\n+\tassert.equal(await blobOid(new Uint8Array()), \"e69de29bb2d1d6434b8b29ae775ad8c2e48c5391\");\n+\tconst bytes = new TextEncoder().encode(\"prefixhello\\nsuffix\");\n+\tassert.equal(await blobOid(bytes.subarray(6, 12)), \"ce013625030ba8dba906f756967f9e9ca394464a\");\n+});\n+\n describe(\"repo names\", () => {\n \tit(\"names a project's Artifacts repo abso-<project>, and back\", () => {\n \t\tassert.equal(repoName(\"game\"), \"abso-game\");\n@@ -22,6 +28,43 @@\n });\n \n describe(\"commitShared\", () => {\n+\tit(\"batches changed text and preserves pending old files in intermediate commits\", async () => {\n+\t\tconst fs = new MemoryFS(),\n+\t\t\tdir = \"/repo\";\n+\t\tawait git.init({ fs, dir, defaultBranch: \"main\" });\n+\t\tconst first = await commitShared(\n+\t\t\tfs,\n+\t\t\tdir,\n+\t\t\tnull,\n+\t\t\t{ version: 0, files: { \"a.txt\": \"old a\", \"b.txt\": \"old b\", \"gone.txt\": \"delete\" } },\n+\t\t\t() => null,\n+\t\t);\n+\t\tconst parts: string[] = [];\n+\t\tconst body = \"x\".repeat(9 * 1024 * 1024);\n+\t\tconst next = await commitShared(\n+\t\t\tfs,\n+\t\t\tdir,\n+\t\t\tfirst.commit,\n+\t\t\t{ version: 1, files: { \"a.txt\": body, \"b.txt\": body + \"b\" } },\n+\t\t\t() => null,\n+\t\t\tasync (commit) => {\n+\t\t\t\tparts.push(commit);\n+\t\t\t\tassert.equal(\n+\t\t\t\t\tnew TextDecoder().decode((await git.readBlob({ fs, dir, oid: commit, filepath: \"b.txt\" })).blob),\n+\t\t\t\t\t\"old b\",\n+\t\t\t\t);\n+\t\t\t\tassert.equal((await git.readBlob({ fs, dir, oid: commit, filepath: \"a.txt\" })).blob.length, body.length);\n+\t\t\t\tawait assert.rejects(() => git.readBlob({ fs, dir, oid: commit, filepath: \"gone.txt\" }));\n+\t\t\t},\n+\t\t);\n+\t\tassert.equal(parts.length, 1);\n+\t\tassert.deepEqual((await git.readCommit({ fs, dir, oid: next.commit })).commit.parent, parts);\n+\t\tassert.equal(\n+\t\t\tnew TextDecoder().decode((await git.readBlob({ fs, dir, oid: next.commit, filepath: \"b.txt\" })).blob),\n+\t\t\tbody + \"b\",\n+\t\t);\n+\t\tassert.equal(absoVersion((await git.readCommit({ fs, dir, oid: parts[0]! })).commit.message), 1);\n+\t});\n \tit(\"reads one lazy file at a time and does not read symlink placeholder text\", async (t) => {\n \t\tconst fs = new MemoryFS();\n \t\tconst dir = \"/repo\";"}],"unmatched":[]}