╭ changed ────╮ │src/serve.zig│ ╰─────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────╮ │3 const rp = xit.repo; │ │4 const hash = xit.hash; │ │5 const ui = @import("./ui.zig"); │ │6 +const evt = @import("./event.zig"); │ │7 const web = @import("./web.zig"); │ │8 const serve_ssh_protocol = @import("./serve_ssh_protocol.zig");│ │9 const serve_ssh = @import("./serve_ssh.zig"); │ ╰──────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │13 ssh_listen: []const u8 = "127.0.0.1:8022", │ │14 wui_listen: []const u8 = "127.0.0.1:8000", │ │15 data_dir: []const u8 = ".", │ │16 + // test mode, used by the networking tests. it serves repos directly by │ │17 + // their on-disk path instead of resolving them as <owner>/<repo> through │ │18 + // the event store, giving the plain git-server behavior those tests rely on.│ │19 + is_test: bool = false, │ │20 }; │ │21 │ │22 const ListenAddress = struct { │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │92 try err.print("serving HTTP on {s}, repo root {s}\n", .{ options.http_listen, repo_root_path }); │ │93 try err.flush(); │ │94 │ │90 - runHttpListener(repo_kind, any_repo_opts, io, allocator, repo_root_path, &http_server, &tasks, err); │ │95 + runHttpListener(repo_kind, any_repo_opts, io, allocator, repo_root_path, admin_repo_path, options.is_test, &http_server, &tasks, err);│ │96 │ │97 try err.print("serving SSH on {s}\n", .{options.ssh_listen}); │ │98 try err.flush(); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │100 const ssh_session_handler = serve_ssh.SessionHandler{ │ │101 .admin_repo_path = admin_repo_path, │ │102 .repo_root_path = repo_root_path, │ │103 + .is_test = options.is_test, │ │104 }; │ │105 runSshListener(io, allocator, &host_key, &ssh_session_handler, &ssh_server, &tasks, err);│ │106 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────╮ │122 io: std.Io, │ │123 allocator: std.mem.Allocator, │ │124 repo_root_path: []const u8, │ │125 + admin_repo_path: []const u8, │ │126 + is_test: bool, │ │127 net_server: *std.Io.net.Server,│ │128 tasks: *std.Io.Group, │ │129 err: *std.Io.Writer, │ ╰────────────────────────────────────────╯ ╭────────────────────────────────────────────╮ │132 io: std.Io, │ │133 allocator: std.mem.Allocator, │ │134 repo_root_path: []const u8, │ │135 + admin_repo_path: []const u8, │ │136 + is_test: bool, │ │137 net_server: *std.Io.net.Server,│ │138 tasks: *std.Io.Group, │ │139 err: *std.Io.Writer, │ ╰────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────╮ │150 io: std.Io, │ │151 allocator: std.mem.Allocator,│ │152 repo_root_path: []const u8, │ │153 + admin_repo_path: []const u8, │ │154 + is_test: bool, │ │155 stream: std.Io.net.Stream, │ │156 err: *std.Io.Writer, │ │157 │ ╰──────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │158 fn run(conn: @This()) void { │ │159 defer conn.stream.close(conn.io); │ │148 - handleHttpConnection(repo_kind, any_repo_opts, conn.io, conn.allocator, conn.repo_root_path, conn.stream, conn.err) catch |request_err| { │ │160 + handleHttpConnection(repo_kind, any_repo_opts, conn.io, conn.allocator, conn.repo_root_path, conn.admin_repo_path, conn.is_test, conn.stream, conn.err) catch |request_err| {│ │161 logError(conn.err, "connection failed: {s}\n", .{@errorName(request_err)}); │ │162 }; │ │163 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────╮ │167 .io = ctx.io, │ │168 .allocator = ctx.allocator, │ │169 .repo_root_path = ctx.repo_root_path, │ │170 + .admin_repo_path = ctx.admin_repo_path,│ │171 + .is_test = ctx.is_test, │ │172 .stream = stream, │ │173 .err = ctx.err, │ │174 }}); │ ╰────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────╮ │180 .io = io, │ │181 .allocator = allocator, │ │182 .repo_root_path = repo_root_path, │ │183 + .admin_repo_path = admin_repo_path,│ │184 + .is_test = is_test, │ │185 .net_server = net_server, │ │186 .tasks = tasks, │ │187 .err = err, │ ╰────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯