╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──╮ │src/web.zig│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │170 switch (host) { │ │171 .server => |server| { │ │172 // "repo/new" and "user/new" come before "new", which would claim them │ │173 - const PostRoute = enum { login, logout, @"repo/new", @"user/new", user, addkey, removekey, delete, settings, grant, revoke, promote, demote, protect, unprotect, new, edit, remove, open, close, resolve, publish, merge, squash, attach, assign, unassign, subscribe, mute, undo }; │ │173 + const PostRoute = enum { login, logout, @"repo/new", @"user/new", user, addkey, removekey, delete, settings, grant, revoke, promote, demote, protect, unprotect, default, new, edit, remove, open, close, resolve, publish, merge, squash, attach, assign, unassign, subscribe, mute, undo };│ │174 inline for (@typeInfo(PostRoute).@"enum".field_names) |name| { │ │175 const suffix = "/" ++ name; │ │176 if (std.mem.endsWith(u8, path, suffix)) { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │191 .demote => handleMembers(io, request, allocator, base, host, .demote), │ │192 .protect => handleBranches(io, request, allocator, base, host, .protect), │ │193 .unprotect => handleBranches(io, request, allocator, base, host, .unprotect),│ │194 + .default => handleBranches(io, request, allocator, base, host, .default), │ │195 .new => handleNew(io, request, allocator, base, host), │ │196 .edit => handleEdit(io, request, allocator, base, host), │ │197 .remove => handleRemove(io, request, allocator, base, host), │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │814 try request.respond("", .{ .status = .see_other, .keep_alive = false, .extra_headers = &.{.{ .name = "location", .value = location }} }); │ │815 } │ │816 │ │816 -// protect or unprotect a branch of the repo the branches url `base` names, as │ │817 -// one of its owners, then redirect back to the list. the add form names the │ │818 -// branch in its body and the row forms in the url. │ │817 +// make a branch the default, or protect or unprotect it, in the repo the │ │818 +// branches url `base` names, as one of its owners, then redirect back to the │ │819 +// list. the default and add forms name the branch in their body and the row │ │820 +// forms in the url. │ │821 fn handleBranches(io: std.Io, request: *std.http.Server.Request, allocator: std.mem.Allocator, base: []const u8, host: Host, action: ui.Repo.Branches.Action) !void {│ │822 const server = switch (host) { │ │823 .server => |server| server, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │832 const actor = (try authorizeWrite(io, allocator, &arena, request, host, try arena.allocator().print("/{s}", .{identity}), .owner, null)) orelse return;│ │833 │ │834 const branch = switch (action) { │ │833 - .protect => blk: { │ │835 + .default, .protect => blk: { │ │836 const body = try readFormBody(request, allocator); │ │837 defer allocator.free(body); │ │838 break :blk (try parseFormField(arena.allocator(), body, "name")) orelse ""; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │845 else => return err, │ │846 }; │ │847 const location = try (ui.RoutablePage.repoBranchesRoute(identity) orelse return error.RouteTooLong).toUrl(&arena); │ │846 - if (failure) |value| return respondFormFailure(request, allocator, server.session_store, location, .{ .repo_branches = .{ .failure = value, .name = branch } }); │ │848 + if (failure) |value| return respondFormFailure(request, allocator, server.session_store, location, .{ .repo_branches = .{ .failure = value, .name = branch, .default = action == .default } });│ │849 try request.respond("", .{ .status = .see_other, .keep_alive = false, .extra_headers = &.{.{ .name = "location", .value = location }} }); │ │850 } │ │851 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯