╭ changed ───╮ │src/fork.zig│ ╰────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 99 { │ │100 try target_repo.core.db_file.lock(io, .shared); │ │101 defer target_repo.core.db_file.unlock(io); │ │102 - try target_repo.core.chunk_store_file.lock(io, .shared); │ │103 - defer target_repo.core.chunk_store_file.unlock(io); │ │102 │ │105 - // TODO: use reflinks here when the filesystem supports them │ │106 - for ([_]struct { file: std.Io.File, name: []const u8 }{ │ │107 - .{ .file = target_repo.core.db_file, .name = "db" }, │ │108 - .{ .file = target_repo.core.chunk_store_file, .name = "chunks" }, │ │109 - }) |source| { │ │110 - const destination = try fork_repo_dir.createFile(io, source.name, .{ .exclusive = true, .read = true }); │ │111 - defer destination.close(io); │ │112 - var read_buffer: [64 * 1024]u8 = undefined; │ │113 - var write_buffer: [64 * 1024]u8 = undefined; │ │114 - var reader = source.file.reader(io, &read_buffer); │ │115 - var writer = destination.writer(io, &write_buffer); │ │116 - _ = try reader.interface.streamRemaining(&writer.interface); │ │117 - try writer.interface.flush(); │ │118 - try destination.sync(io); │ │119 - } │ │103 + // TODO: use reflink here when the filesystem supports it │ │104 + const destination = try fork_repo_dir.createFile(io, "db", .{ .exclusive = true, .read = true }); │ │105 + defer destination.close(io); │ │106 + var read_buffer: [64 * 1024]u8 = undefined; │ │107 + var write_buffer: [64 * 1024]u8 = undefined; │ │108 + var reader = target_repo.core.db_file.reader(io, &read_buffer); │ │109 + var writer = destination.writer(io, &write_buffer); │ │110 + _ = try reader.interface.streamRemaining(&writer.interface); │ │111 + try writer.interface.flush(); │ │112 + try destination.sync(io); │ │113 } │ │114 │ │115 var fork_repo = try rp.Repo(.xit, repo_opts).open(io, allocator, .{ .path = fork_path, .require_repo_root = true });│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │369 if (!try evt.consumeInTransaction(.fork, .xit, repo_opts, state, &ctx.core.db, &moment, ctx.io, ctx.allocator, evt.events_ref)) return error.CancelTransaction;│ │370 } │ │371 try xit.undo.writeMessage(repo_opts, state, .push); │ │379 - try ctx.core.chunk_store_file.sync(ctx.io); │ │372 } │ │373 }; │ │374 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯