╭ changed ────────╮ │src/serve_ssh.zig│ ╰─────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │23 │ │24 var active_connections: std.atomic.Value(u32) = .init(0); │ │25 │ │26 -const any_repo_opts: rp.AnyRepoOpts(.xit) = .{ .ProgressCtx = *push.PushProgress }; │ │26 +const any_repo_opts: rp.AnyRepoOpts(.xit) = .{ .ProgressCtx = *serve_common.PushProgress };│ │27 │ │28 pub const SessionHandler = struct { │ │29 admin_repo_path: []const u8, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │395 }; │ │396 defer allocator.free(repo_path); │ │397 │ │398 - if (try serveIfExists(repo_path, handler.repo_root_path, &reader.interface, &writer.interface, io, allocator, parsed.service, protocol_version, author, handler.err)) return; │ │398 + if (try serveIfExists(repo_path, handler.repo_root_path, &reader.interface, &writer.interface, io, allocator, parsed.service, protocol_version, author, handler.err, sess)) return;│ │399 │ │400 if (!create_if_missing) return writeError(sess, "repo not found"); │ │401 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │402 // create the on-disk repo for the just-minted event and serve the push │ │403 var repo = try createRepo(any_repo_opts.toRepoOpts(), io, allocator, repo_path); │ │404 defer repo.deinit(io, allocator); │ │405 - try servePack(repo.self_repo_opts, &repo, handler.repo_root_path, &reader.interface, &writer.interface, io, allocator, parsed.service, protocol_version, author, handler.err); │ │405 + try servePack(repo.self_repo_opts, &repo, handler.repo_root_path, &reader.interface, &writer.interface, io, allocator, parsed.service, protocol_version, author, handler.err, sess);│ │406 } │ │407 │ │408 // serve a patch draft: anyone may fetch it, only its author may push to it │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │459 var target_repo = rp.Repo(.xit, repo.self_repo_opts).open(io, allocator, .{ .path = target_path }) catch │ │460 return writeError(sess, "repo not found or has the wrong hash"); │ │461 defer target_repo.deinit(io, allocator); │ │462 - try push.receiveFork(repo.self_repo_opts, io, allocator, repo, &target_repo, &route.id, author, timestamp, reader, writer, handler.err); │ │462 + try push.receiveFork(repo.self_repo_opts, io, allocator, repo, &target_repo, &route.id, author, timestamp, reader, writer, handler.err, sess);│ │463 }, │ │464 } │ │465 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────╮ │477 protocol_version: xit.net_server_common.ProtocolVersion, │ │478 author: ?evt.CommitAuthor, │ │479 error_writer: *std.Io.Writer, │ │480 + sess: ?*ssh.SessionCtx, │ │481 ) !bool { │ │482 // a bare open() creates the directory while probing for the repo, so only│ │483 // attempt it when the path already exists │ ╰───────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │490 defer any_repo.deinit(io, allocator); │ │491 │ │492 switch (any_repo) { │ │492 - inline else => |*repo| try servePack(repo.self_repo_opts, repo, repo_root_path, reader, writer, io, allocator, service, protocol_version, author, error_writer), │ │493 + inline else => |*repo| try servePack(repo.self_repo_opts, repo, repo_root_path, reader, writer, io, allocator, service, protocol_version, author, error_writer, sess),│ │494 } │ │495 return true; │ │496 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │520 protocol_version: xit.net_server_common.ProtocolVersion, │ │521 author: ?evt.CommitAuthor, │ │522 error_writer: *std.Io.Writer, │ │523 + sess: ?*ssh.SessionCtx, │ │524 ) !void { │ │525 switch (service) { │ │526 .upload_pack => try repo.uploadPack(io, allocator, reader, writer, .{ .protocol_version = protocol_version }),│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │525 - .receive_pack => try push.receivePackAndConsume(repo_opts, io, allocator, repo, reader, writer, .{ .protocol_version = protocol_version }, author, repo_root_path, error_writer), │ │527 + .receive_pack => try push.receivePackAndConsume(repo_opts, io, allocator, repo, reader, writer, .{ .protocol_version = protocol_version }, author, repo_root_path, error_writer, sess),│ │528 } │ │529 } │ │530 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯