╭ changed ──────╮ │src/command.zig│ ╰───────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────╮ │198 if (cmd_args.get("--data-dir")) |val_maybe| { │ │199 options.data_dir = val_maybe orelse return error.DataDirNeedsValue;│ │200 } │ │201 - if (cmd_args.contains("--test")) { │ │202 - options.is_test = true; │ │203 - } │ │201 │ │202 return .{ .serve = options }; │ │203 }, │ ╰────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ────╮ │src/serve.zig│ ╰─────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │11 ssh_listen: []const u8 = "127.0.0.1:8022", │ │12 wui_listen: []const u8 = "127.0.0.1:8000", │ │13 data_dir: []const u8 = ".", │ │14 - // test mode, used by the networking tests. it serves repos directly by │ │15 - // their on-disk path instead of resolving them as <owner>/<repo> through │ │16 - // the event store, giving the plain git-server behavior those tests rely on.│ │17 - is_test: bool = false, │ │14 }; │ │15 │ │16 const ListenAddress = struct { │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │86 try err.print("serving HTTP on {s}, repo root {s}\n", .{ options.http_listen, repo_root_path }); │ │87 try err.flush(); │ │88 │ │93 - serve_http.runListener(repo_kind, any_repo_opts, io, allocator, repo_root_path, admin_repo_path, options.is_test, &http_server, &tasks, err);│ │89 + serve_http.runListener(repo_kind, any_repo_opts, io, allocator, repo_root_path, admin_repo_path, &http_server, &tasks, err); │ │90 │ │91 try err.print("serving SSH on {s}\n", .{options.ssh_listen}); │ │92 try err.flush(); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 94 const ssh_session_handler = serve_ssh.SessionHandler{ │ │ 95 .admin_repo_path = admin_repo_path, │ │ 96 .repo_root_path = repo_root_path, │ │101 - .is_test = options.is_test, │ │ 97 .err = err, │ │ 98 }; │ │ 99 serve_ssh.runListener(io, allocator, &host_key, &ssh_session_handler, &ssh_server, &tasks, err);│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────────╮ │src/serve_common.zig│ ╰────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │ 9 not_found, // unknown owner, or the repo doesn't exist and we aren't creating│ │10 }; │ │11 │ │12 -// resolve a requested repo path to its on-disk directory. in test mode the path │ │13 -// is served directly; otherwise it's resolved as <owner>/<repo> through the │ │14 -// event store, minting a repo event for a fresh push. │ │12 +// resolve a requested repo path to its on-disk directory, parsed as │ │13 +// <owner>/<repo> through the event store, minting a repo event for a fresh push.│ │14 pub fn resolveRepoPath( │ │15 io: std.Io, │ │16 allocator: std.mem.Allocator, │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────╮ │18 - is_test: bool, │ │17 repo_root_path: []const u8, │ │18 admin_repo_path: []const u8,│ │19 requested: []const u8, │ ╰────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │20 create_if_missing: bool, │ │21 ) !RepoPath { │ │24 - // the networking tests address repos by a trusted on-disk path (an absolute │ │25 - // `requested` discards repo_root), so no traversal check is needed here │ │26 - if (is_test) { │ │27 - return .{ .ok = try std.fs.path.resolve(allocator, &.{ repo_root_path, requested }) }; │ │28 - } │ │29 - │ │22 const owner_repo = evt.parseOwnerRepoPath(requested) orelse return .invalid; │ │23 const event_id_hex = (try evt.resolveOrCreateRepo(io, allocator, admin_repo_path, owner_repo.owner, owner_repo.name, create_if_missing)) orelse return .not_found;│ │24 return .{ .ok = try std.fs.path.join(allocator, &.{ repo_root_path, &event_id_hex }) }; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────╮ │src/serve_http.zig│ ╰──────────────────╯ ╭───────────────────────────────────────╮ │10 allocator: std.mem.Allocator, │ │11 repo_root_path: []const u8, │ │12 admin_repo_path: []const u8, │ │13 - is_test: bool, │ │13 net_server: *std.Io.net.Server,│ │14 tasks: *std.Io.Group, │ │15 err: *std.Io.Writer, │ ╰───────────────────────────────────────╯ ╭─────────────────────────────────────────╮ │19 allocator: std.mem.Allocator,│ │20 repo_root_path: []const u8, │ │21 admin_repo_path: []const u8, │ │23 - is_test: bool, │ │22 err: *std.Io.Writer, │ │23 }; │ │24 │ ╰─────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │25 const handle = struct { │ │26 fn h(ctx: Context, stream: std.Io.net.Stream) void { │ │27 defer stream.close(ctx.io); │ │30 - handleConnection(repo_kind, any_repo_opts, ctx.io, ctx.allocator, ctx.repo_root_path, ctx.admin_repo_path, ctx.is_test, stream, ctx.err) catch |request_err| {│ │28 + handleConnection(repo_kind, any_repo_opts, ctx.io, ctx.allocator, ctx.repo_root_path, ctx.admin_repo_path, stream, ctx.err) catch |request_err| { │ │29 serve_common.logError(ctx.err, "connection failed: {s}\n", .{@errorName(request_err)}); │ │30 }; │ │31 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯