Lines 127–133 at 318 (were 127–133 at 40)
127127 const atom = repo.edit({ edits: [{ file: "f.txt", old: "five\n", new: "five\nsix\n" }] }); 128128 assert.deepEqual(atom.writes, [gapKey("a0.4")]); 129129 assert.deepEqual(atom.reads, [lineKey("a0.4")]); 130− assert.equal(repo.text("f.txt"), FIVE + "six\n");
130+ assert.equal(repo.text("f.txt"), `${FIVE}six\n`); Lines 335–342 at 318 (were 335–341 at 40)
335335 assert.equal(repo.text("g.txt"), "g1\ng2\n"); 336336 const edited = repo.edit({ edits: [{ file: "g.txt", old: "g2", new: "G2" }] }); 337337 const removed = repo.edit({ edits: [{ file: "g.txt", old: "g1\nG2\n", new: "" }] }); 338− assert.deepEqual(removed.deps, [created.id, edited.id]);
338+ assert.deepEqual(removed.deps, [edited.id]); 339+ assert.deepEqual(repo.graph.closureOf(removed.deps), repo.graph.closureOf([created.id, edited.id])); 339340 assert.equal(repo.view().hasFile("g.txt"), false); 340341 assert.deepEqual(Object.keys(repo.files()), ["f.txt"]); 341342 assert.deepEqual(repo.view().knownPaths(), ["f.txt", "g.txt"]); Lines 344–351 at 318 (were 343–349 at 40)
343344 // lines hang off the start (gap rule) and on the deletions: it relies on 344345 // the file being empty, so its closure shows only the new text. 345346 const again = repo.edit({ edits: [{ file: "g.txt", old: "", new: "fresh\n" }] }); 346− assert.deepEqual(again.deps, [created.id, edited.id, removed.id]);
347+ assert.deepEqual(again.deps, [removed.id]); 348+ assert.deepEqual(repo.graph.closureOf(again.deps), repo.graph.closureOf([created.id, edited.id, removed.id])); 347349 assert.equal(repo.text("g.txt"), "fresh\n"); 348350 assert.equal(repo.text("g.txt", repo.graph.closure(again.id)), "fresh\n"); Lines 397–404 at 318 (were 395–401 at 40)
395397 reliesOn: [{ file: "g.txt", start: 0, end: 1 }], 397399 assert.deepEqual(atom.holds, [lineKey(`${g2.id}.0`)]); 398− assert.deepEqual(atom.deps, ["a0", g2.id]);
400+ assert.deepEqual(atom.deps, [g2.id]); 401+ assert.deepEqual(repo.graph.closureOf(atom.deps), repo.graph.closureOf(["a0", g2.id])); 401404 it("reliesOn a range of lines also holds the gaps between them", () => { Lines 439–446 at 318 (were 436–442 at 40)
436439 const three = repo.edit({ edits: [{ file: "f.txt", old: "three", new: "THREE" }] }); 437440 // Inserting after "two": the gap holds mid (a tombstone hanging off "two") and then THREE. 438441 const atom = repo.edit({ edits: [{ file: "f.txt", old: "two\n", new: "two\nnew\n", mode: "after" }] }); 439− assert.deepEqual(atom.deps, ["a0", added.id]);
442+ assert.deepEqual(atom.deps, [added.id]); 443+ assert.deepEqual(repo.graph.closureOf(atom.deps), repo.graph.closureOf(["a0", added.id])); 440444 assert.equal(repo.text("f.txt"), lines("one", "two", "new", "THREE", "four", "five")); 441445 // It outranks mid, so it sits directly after "two" in any set; in its own 442446 // closure mid is back (the deletion isn't in it) and stays below it. Lines 485–492 at 318 (were 481–487 at 40)
481485 const draft = repo.draft({ message: "N after X", edits: [{ file: "f.txt", start: 1, end: 1, lines: ["N"] }] }); 482486 assert.deepEqual(repo.check(draft).conflicts, []); 483487 const N = repo.edit({ message: "N after X", edits: [{ file: "f.txt", start: 1, end: 1, lines: ["N"] }] }); 484− assert.deepEqual(N.deps, ["a0", A.id, B.id]);
488+ assert.deepEqual(N.deps, [A.id, B.id]); 489+ assert.deepEqual(repo.graph.closureOf(N.deps), repo.graph.closureOf(["a0", A.id, B.id])); 485490 assert.equal(repo.text("f.txt"), lines("X", "N", "B", "A", "Y")); 487492 conflicts(repo.graph, repo.shared).map((c) => c.atoms), Lines 509–516 at 318 (were 504–510 at 40)
504509 // Deleting "three" (the line below the insert) touches nothing the insert wrote, 505510 // but it changes a line the insert read: a sequential edit, so a dependency. 506511 const atom = repo.edit({ edits: [{ file: "f.txt", old: "three\n", new: "" }] }); 507− assert.deepEqual(atom.deps, ["a0", between.id]);
512+ assert.deepEqual(atom.deps, [between.id]); 513+ assert.deepEqual(repo.graph.closureOf(atom.deps), repo.graph.closureOf(["a0", between.id])); 509515 checkDraft(repo.graph, repo.shared, repo.draft({ edits: [{ file: "f.txt", old: "four\n", new: "" }] })).conflicts,