╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │197 .title = title, │ │198 .description = description, │ │199 .tags = tags, │ │200 + .target_branch = target_branch, │ │201 .author = author, │ │202 .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()),│ │203 }); │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────╮ │258 title: []const u8, │ │259 tags: []const u8, │ │260 description: []const u8, │ │261 + target_branch: []const u8, │ │262 ) !void { │ │263 const io = session.io orelse return error.NotFound; │ │264 const repos_dir = session.repos_dir orelse return error.NotFound;│ ╰──────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │265 const admin_repo = session.admin_repo orelse return error.NotFound; │ │266 const repo_id = data.repo_id orelse return error.NotFound; │ │267 + const repo_source = data.repo_source orelse return error.NotFound; │ │268 const user_id = session.userId() orelse return error.NotFound; │ │269 const patch_id = evt.parseEventId(id) catch return error.NotFound; │ │270 const author = (try session.eventAuthor()) orelse return error.NotFound;│ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │271 + if (!try repo_source.hasBranch(io, allocator, target_branch)) return error.InvalidFields;│ │272 │ │273 const id_hex = std.fmt.bytesToHex(patch_id, .lower); │ │274 const fork_path = try fork.forkPath(allocator, repos_dir, &id_hex); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────╮ │280 .title = title, │ │281 .tags = tags, │ │282 .description = description, │ │283 + .target_branch = target_branch, │ │284 .author = author, │ │285 .timestamp = @intCast(std.Io.Timestamp.now(io, .real).toSeconds()),│ │286 })) return error.NotFound; │ ╰────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │331 pub fn emptyResult(aa: std.mem.Allocator, identity: []const u8, tag: []const u8, selected_id: []const u8, comment_id: []const u8, comments_start: usize, theirs_picks: []const u8, view: ui.RoutablePage.PatchesView) !Self {│ │332 return .{ │ │333 .identity = try aa.dupe(u8, identity), │ │334 + .default_target_branch = "", │ │335 .tag = try aa.dupe(u8, tag), │ │336 .selected_id = try aa.dupe(u8, selected_id), │ │337 .comment_id = try aa.dupe(u8, comment_id), │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │402 ) !Self { │ │403 const allowed_view: ui.RoutablePage.PatchesView = if (session.local != null and (view == .new or view == .drafts)) .open else view;│ │404 var empty = try emptyResult(arena.allocator(), identity, tag, selected_id, comment_id, comments_start, theirs_picks, allowed_view);│ │405 + empty.default_target_branch = try arena.allocator().dupe(u8, target_branch); │ │406 │ │407 const aa = arena.allocator(); │ │408 const DB = evt.EventDB(repo_opts.hash); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │411 const drafts_window = if (admin_moment) |admin| │ │412 if (repo_id_maybe) |repo_id| │ │413 if (session.data.user_id != null and session.repos_dir != null) │ │403 - try loadDraftWindow(repo_kind, repo_opts, arena, session, admin, &repo_id, empty.selected_id, repo, target_branch)│ │414 + try loadDraftWindow(repo_kind, repo_opts, arena, session, admin, &repo_id, empty.selected_id, repo) │ │415 else │ │416 Window.empty │ │417 else │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │545 var closed_window = try thread.loadWindow(Self, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_patch, closed_set, closed_root, conflict_set, empty.selected_id, thread_comments_start); │ │546 var merged_window = try thread.loadWindow(Self, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_patch, merged_set, merged_root, conflict_set, empty.selected_id, thread_comments_start); │ │547 var conflicts_window = try thread.loadWindow(Self, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_patch, conflict_set, conflicts_root, conflict_set, empty.selected_id, thread_comments_start);│ │537 - try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, target_branch, &open_window); │ │538 - try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, target_branch, &closed_window); │ │539 - try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, target_branch, &merged_window); │ │540 - try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, target_branch, &conflicts_window); │ │548 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &open_window); │ │549 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &closed_window); │ │550 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &merged_window); │ │551 + try setForkDetails(repo_kind, repo_opts, io, arena, admin_moment, repo, &conflicts_window); │ │552 if (view == .conflicts and conflicts_window.count > 0) resolved_view = .conflicts; │ │553 │ │554 const comment_page = if (empty.comment_id.len == 0) │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────╮ │560 │ │561 return .{ │ │562 .identity = empty.identity, │ │563 + .default_target_branch = empty.default_target_branch,│ │564 .tag = empty.tag, │ │565 .selected_id = empty.selected_id, │ │566 .comment_id = empty.comment_id, │ ╰──────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯