Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 151 to 318

Compare

+71 −1 in 2 places
Lines 3–16 at 318 (were 3–10 at 151)
33import git from "isomorphic-git";
44import { absoVersion } from "../src/ingest.ts";
55import { MemoryFS } from "../src/memory-fs.ts";
6−import { commitShared, projectOfRepo, readTreeFiles, repoName } from "../src/push.ts";
6+import { blobOid, commitShared, projectOfRepo, readTreeFiles, repoName } from "../src/push.ts";
77
8+it("hashes exact Git blob bytes including a nonzero buffer offset", async () => {
9+ assert.equal(await blobOid(new Uint8Array()), "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391");
10+ const bytes = new TextEncoder().encode("prefixhello\nsuffix");
11+ assert.equal(await blobOid(bytes.subarray(6, 12)), "ce013625030ba8dba906f756967f9e9ca394464a");
12+});
814describe("repo names", () => {
915 it("names a project's Artifacts repo abso-<project>, and back", () => {
1016 assert.equal(repoName("game"), "abso-game");
Lines 28–97 at 318 (were 22–27 at 151)
2228});
2329
2430describe("commitShared", () => {
31+ it("batches changed text and preserves pending old files in intermediate commits", async () => {
32+ const fs = new MemoryFS(),
33+ dir = "/repo";
34+ await git.init({ fs, dir, defaultBranch: "main" });
35+ const first = await commitShared(
36+ fs,
37+ dir,
38+ null,
39+ { version: 0, files: { "a.txt": "old a", "b.txt": "old b", "gone.txt": "delete" } },
40+ () => null,
41+ );
42+ const parts: string[] = [];
43+ const body = "x".repeat(9 * 1024 * 1024);
44+ const next = await commitShared(
45+ fs,
46+ dir,
47+ first.commit,
48+ { version: 1, files: { "a.txt": body, "b.txt": body + "b" } },
49+ () => null,
50+ async (commit) => {
51+ parts.push(commit);
52+ assert.equal(
53+ new TextDecoder().decode((await git.readBlob({ fs, dir, oid: commit, filepath: "b.txt" })).blob),
54+ "old b",
55+ );
56+ assert.equal((await git.readBlob({ fs, dir, oid: commit, filepath: "a.txt" })).blob.length, body.length);
57+ await assert.rejects(() => git.readBlob({ fs, dir, oid: commit, filepath: "gone.txt" }));
58+ },
59+ );
60+ assert.equal(parts.length, 1);
61+ assert.deepEqual((await git.readCommit({ fs, dir, oid: next.commit })).commit.parent, parts);
62+ assert.equal(
63+ new TextDecoder().decode((await git.readBlob({ fs, dir, oid: next.commit, filepath: "b.txt" })).blob),
64+ body + "b",
65+ );
66+ assert.equal(absoVersion((await git.readCommit({ fs, dir, oid: parts[0]! })).commit.message), 1);
67+ });
68+ it("reads one lazy file at a time and does not read symlink placeholder text", async (t) => {
69+ const fs = new MemoryFS();
70+ const dir = "/repo";
71+ await git.init({ fs, dir, defaultBranch: "main" });
72+ let writes = 0;
73+ const writeBlob = git.writeBlob;
74+ t.mock.method(git, "writeBlob", async (options: Parameters<typeof writeBlob>[0]) => {
75+ const result = await writeBlob(options);
76+ writes++;
77+ return result;
78+ });
79+ const files = {
80+ get a() {
81+ assert.equal(writes, 0);
82+ return "first";
83+ },
84+ get b() {
85+ assert.equal(writes, 1);
86+ return "second";
87+ },
88+ get link(): string {
89+ throw Error("symlink placeholder text must not be read");
90+ },
91+ };
92+ await commitShared(fs, dir, null, { version: 0, files, modes: { link: { link: "a" } } }, () => null);
93+ assert.equal(writes, 3);
94+ });
2595 it("writes shared as a commit with its modes, then only what changed", async () => {
2696 const fs = new MemoryFS();
2797 const dir = "/repo";
MCP
compare on this site's /mcp
CLI
abso diff 151 318 server/test/push.test.ts --json
JSON
/christopher/abso-core/compare/151..318?file=server%2Ftest%2Fpush.test.ts&format=json