Index `before`, write `after` over it, sync on the same object; the state, and a full index's of the final tree.
(before: Files, after: Files)
| 70 | |
| 71 | /** Index `before`, write `after` over it, sync on the same object; the state, and a full index's of the final tree. */ |
| 72 | async function syncEdit(before: Files, after: Files): Promise<{ state: string[]; full: string[] }> { |
| 73 | const root = tempRoot(); |
| 74 | write(root, before); |
| 75 | const graph = await index(root); |
| 76 | write(root, after); |
| 77 | await graph.sync(); |
| 78 | const fullRoot = tempRoot(); |
| 79 | write(fullRoot, { ...before, ...after }); |
| 80 | return { state: stateOf(root, graph), full: stateOf(fullRoot, await index(fullRoot)) }; |
| 81 | } |
| 82 | |
| 83 | const held = (state: string[], text: string): string[] => state.filter((line) => line.includes(text)); |
| 84 |