diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 21:16:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | f02c10bfa6d02d305ddb6d7a28b12c40035274c7 (patch) | |
| tree | 1fe0e159cd3d24f0ed67d3358e3d6bcab9741cf7 /src/ninep/ctl.zig | |
| parent | a2c719779c9ce0f676fb159135675df6275e77bf (diff) | |
| download | pardes-f02c10bfa6d02d305ddb6d7a28b12c40035274c7.tar.gz pardes-f02c10bfa6d02d305ddb6d7a28b12c40035274c7.zip | |
A Restore brings back clean a pane whose file was never on disk, such as Config's new init; only a file that existed when dumped is said deleted
A restored pane whose path was not on disk was marked deleted on disk,
so Config's not-yet-written init came back dirty and asked before Del,
Exit or Restore. The dump now records whether the file was on disk
(older dumps read as yes), and only one that was and is gone is said
deleted.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index a14b1efb..63f89cdf 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -2691,8 +2691,16 @@ test "a restored pane whose file is gone from disk comes back dirty, and Del ask if (comptime !pardes.hosted) return error.SkipZigTest; const p = try withFile(testing.allocator, "kept text\n"); defer p.deinit(); - try pane_files.nameBuffer(p, 0, "/tmp/pardes-restore-gone-xyz/f.txt", false); + // On disk when dumped, gone by the Restore. + var tmp = testing.tmpDir(.{}); + defer tmp.cleanup(); + try tmp.dir.writeFile(testing.io, .{ .sub_path = "f.txt", .data = "kept text\n" }); + var dir_buf: [4096]u8 = undefined; + const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)]; + var path_buf: [4200]u8 = undefined; + try pane_files.nameBuffer(p, 0, try std.fmt.bufPrint(&path_buf, "{s}/f.txt", .{dir}), false); try pardes.dump.dumpState(p); + try tmp.dir.deleteFile(testing.io, "f.txt"); const restored = try pardes.dump.restore(p, p.dump_out.?, "/tmp/pardes.dump.zon"); defer restored.deinit(); const again = restored.panes[restored.paneBySerial(restored.panes[0].?.serial).?].?; |
