╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ───╮ │src/push.zig│ ╰────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │136 var updates = xit.net_server_receive_pack.AppliedRefUpdates.init(allocator); │ │137 defer updates.deinit(); │ │138 │ │138 - var sideband = progress.Sideband{ .response = &response, .writer = writer, .sess = sess }; │ │139 + var sideband = progress.Sideband{ │ │140 + .response = &response, │ │141 + .writer = writer, │ │142 + .sess = sess, │ │143 + .size_limit = if (max_repo_size) |max| .{ .file = repo.core.db_file, .max = max } else null,│ │144 + }; │ │145 // the moment index the pushed events were consumed into │ │146 var moment_index: ?u64 = null; │ │147 const Ctx = struct { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │199 _ = try srch_cmmt.refreshInTransaction(repo_opts, state, &moment, ctx.io, ctx.allocator, moves.items, ctx.sideband);│ │200 │ │201 try writeUndo(repo_opts, state, ctx.io, ctx.allocator, ctx.author, ctx.updates.items.items); │ │202 + // the indexes count against the limit too │ │203 + try ctx.sideband.checkSize(ctx.io); │ │204 } │ │205 }; │ │206 │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────╮ │278 timestamp: u64, │ │279 reader: *std.Io.Reader, │ │280 writer: *std.Io.Writer, │ │281 + max_repo_size: ?u64, │ │282 error_writer: *std.Io.Writer,│ │283 sess: ?*ssh.SessionCtx, │ │284 ) !void { │ ╰──────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │313 var revision_id_maybe: ?[evt.event_id_size]u8 = null; │ │314 var response = xit.net_server_receive_pack.Response.init(allocator); │ │315 defer response.deinit(); │ │307 - var sideband = progress.Sideband{ .response = &response, .writer = writer, .sess = sess }; │ │316 + var sideband = progress.Sideband{ │ │317 + .response = &response, │ │318 + .writer = writer, │ │319 + .sess = sess, │ │320 + .size_limit = if (max_repo_size) |max| .{ .file = fork_repo.core.db_file, .max = max } else null,│ │321 + }; │ │322 │ │323 // execute a transaction that receives the push and materializes its revision │ │324 const result = blk: { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │414 │ │415 // a fork push tracks no ref updates, so it records no ranges │ │416 try writeUndo(repo_opts, state, ctx.io, ctx.allocator, ctx.author, &.{});│ │417 + // the copied target history and the index count against the limit too │ │418 + try ctx.sideband.checkSize(ctx.io); │ │419 } │ │420 }; │ │421 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────╮ │src/serve.zig│ ╰─────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │15 // the public urls shown to users, defaulting to localhost and the bound port│ │16 web_url: ?[]const u8 = null, │ │17 ssh_url: ?[]const u8 = null, │ │18 + // the size a pushed repo's db may grow to, or null for no limit │ │19 + max_repo_size: ?u64 = null, │ │20 data_dir: []const u8 = ".", │ │21 git_ssh_prefix: []const u8 = "", │ │22 fallback_on_address_in_use: bool = false, │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────╮ │123 .web_url = web_url, │ │124 .ssh_url = ssh_url, │ │125 .git_ssh_prefix = options.git_ssh_prefix,│ │126 + .max_repo_size = options.max_repo_size, │ │127 .err = err, │ │128 }, │ │129 }; │ ╰──────────────────────────────────────────────────────────────╯ ╭ changed ────────╮ │src/serve_ssh.zig│ ╰─────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │34 web_url: []const u8, │ │35 ssh_url: ?[]const u8, │ │36 git_ssh_prefix: []const u8, │ │37 + // the size a pushed repo's db may grow to, or null for no limit │ │38 + max_repo_size: ?u64, │ │39 err: *std.Io.Writer, │ │40 │ │41 /// returning without an exit leaves the protocol layer to send status 0│ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │420 .protected_branches = pusher.protected_branches, │ │421 .locked_branches = pusher.locked_branches, │ │422 .pseudo_ref = .{ .name = push.clear_undo_ref, .deletable = pusher.owner }, │ │421 - }, pusher.author, &pusher.user_id, handler.server, handler.err, sess), │ │423 + }, pusher.author, &pusher.user_id, handler.server, handler.max_repo_size, handler.err, sess),│ │424 }, │ │425 } │ │426 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │458 var repo = try rp.Repo(.xit, any_repo_opts.toRepoOptsWithHash(kind)).open(io, allocator, .{ .path = repo_path }); │ │459 defer repo.deinit(io, allocator); │ │460 // stateless since the advertisement already went out │ │459 - try push.receivePackAndConsume(repo.self_repo_opts, io, allocator, &repo, reader, writer, .{ .protocol_version = protocol_version, .is_stateless = true, .pseudo_ref = .{ .name = push.clear_undo_ref, .deletable = true } }, creator.owner, &creator.owner_id, handler.server, handler.err, sess); │ │461 + try push.receivePackAndConsume(repo.self_repo_opts, io, allocator, &repo, reader, writer, .{ .protocol_version = protocol_version, .is_stateless = true, .pseudo_ref = .{ .name = push.clear_undo_ref, .deletable = true } }, creator.owner, &creator.owner_id, handler.server, handler.max_repo_size, handler.err, sess);│ │462 }, │ │463 } │ │464 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯