OXYGENHUB

0.2.1: wrapper test reordered so amend runs on a single head; the 0.2.0 commit had a failing test 5779e5c731a6

Author
Andy McCall @andymccall <[email protected]>
When
· 2026-09-27 15:48 UTC
Signature
✔ signed by Andy McCall
Hash
5779e5c731a6666537f94047549e4a4120eeba1bbe0da14db786dffc8cd576d5
Depends on
35d56b5803d9 bed495a96408
Depended on by
c8f955891224
In bookmarks
main
In tags
v0.16.0 v0.16.1 v0.17.0 v0.17.1 v0.18.0
Edits
7 atoms, 0 tree operations, 2 files

Browse the tree at this change

modified package.json +1 −1
…
1 unchanged lines
2 2
  "name": "oxygen-vscode",
3 3
  "displayName": "Oxygen",
4 4
  "description": "Oxygen version control: source control view, diffs, decorations, bookmarks and history for oxy repositories",
5 -
  "version": "0.2.0",
5 +
  "version": "0.2.1",
6 6
  "publisher": "oxygen",
7 7
  "license": "MIT OR Apache-2.0",
8 8
  "icon": "assets/images/oxygen.png",
…
130 unchanged lines
modified test/oxy.test.mjs +12 −7
…
44 unchanged lines
45 45
  assert.deepEqual(bookmarks.map((b) => [b.name, b.current]), [["main", true]]);
46 46
  await assert.rejects(oxy.cat(root, "missing.txt"), /not in that state/);
47 47
48 -
  // Write operations: hunks, commit by hunk, discard, amend, undo, op log.
48 +
  // Amend folds the edit into the single head.
49 +
  await oxy.amend(root, "first, amended");
50 +
  assert.equal((await oxy.status(root)).clean, true);
51 +
  assert.ok((await oxy.log(root, 10)).changes.some((c) => c.message === "first, amended"));
52 +
53 +
  // Hunks: commit only b.txt's, leave a.txt's edit, then discard it.
54 +
  writeFileSync(join(root, "a.txt"), "one\ntwo\nthree\n");
49 55
  writeFileSync(join(root, "b.txt"), "b\n");
50 56
  const hunks = await oxy.hunks(root);
51 57
  assert.ok(hunks.length >= 2, JSON.stringify(hunks));
…
1 unchanged lines
53 59
  await oxy.commitHunks(root, "b only", [bHunk.index]);
54 60
  status = await oxy.status(root);
55 61
  assert.deepEqual(status.paths.map((p) => p.path), ["a.txt"], "a.txt stays uncommitted");
62 +
  assert.equal((await oxy.cat(root, "b.txt")).toString(), "b\n", "committed with its content");
56 63
  await oxy.discard(root, ["a.txt"]);
57 64
  assert.equal((await oxy.status(root)).clean, true);
58 -
  writeFileSync(join(root, "b.txt"), "b\nmore\n");
59 -
  await oxy.amend(root, "b, amended");
60 -
  assert.equal((await oxy.status(root)).clean, true);
61 -
  const log2 = await oxy.log(root, 10);
62 -
  assert.ok(log2.changes.some((c) => c.message === "b, amended"));
65 +
66 +
  // The operation log, and undo of the last operation (the commit).
63 67
  const ops = await oxy.opLog(root);
64 68
  assert.ok(ops[0].current && ops.length > 3);
65 69
  assert.match(await oxy.undo(root), /Undone/);
66 -
  assert.equal((await oxy.status(root)).clean, false, "the amend is undone; its edit is back on disk as uncommitted work");
70 +
  status = await oxy.status(root);
71 +
  assert.ok(status.paths.some((p) => p.path === "b.txt"), "the commit is undone; b.txt is uncommitted work again");
67 72
});