╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────╮ │src/ui/Fork.zig│ ╰───────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │70 null; │ │71 defer if (target_repo_maybe) |*target_repo| target_repo.deinit(io, arena.child_allocator); │ │72 │ │73 - var target_branch = if (retained_patch.event.revision) |revision| revision.targetBranch() orelse "" else "";│ │74 - if (target_repo_maybe) |*target_repo| { │ │75 - if (target_branch.len == 0) { │ │76 - if (try ui.ResolvedRefOrOid(.xit, .{}).init(target_repo, io, aa, null, "")) |resolved| │ │77 - target_branch = resolved.value; │ │78 - } │ │79 - } │ │73 + const target_branch = retained_patch.event.target_branch; │ │74 │ │75 const retained_entry = Patches.PatchWithId{ │ │76 .id = try aa.dupe(u8, &id_hex), │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ │78 .author = try ui.Author.initFromEmail(haxy_moment, arena, retained_patch.author_email),│ │79 .draft = fork_record.event.stage == .draft, │ │80 .fork_oid = try aa.dupe(u8, &fork_oid), │ │87 - .target_branch = try aa.dupe(u8, target_branch), │ │81 .fork_exists = true, │ │82 }; │ │83 var patch_data = try Patches.detailResult(aa, identity.identity, retained_entry); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │84 │ │85 if (target_repo_maybe) |*target_repo| switch (fork_record.event.stage) { │ │93 - .draft => if (try Patches.loadDraftEntry(.xit, .{}, arena, io, haxy_moment, &fork_repo, target_repo, id, target_branch)) |entry| {│ │86 + .draft => if (try Patches.loadDraftEntry(.xit, .{}, arena, io, haxy_moment, &fork_repo, target_repo, id)) |entry| { │ │87 patch_data = try Patches.detailResult(aa, identity.identity, entry); │ │88 patch_data.repo_source = target_source; │ │89 }, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │ 92 error.NotFound => patch_data, │ │ 93 else => |other| return other, │ │ 94 }; │ │102 - if (patch_data.selectedThread()) |entry| { │ │103 - patch_data.repo_source = target_source; │ │104 - if (entry.record.event.revision) |revision| { │ │105 - if (revision.targetBranch()) |branch| target_branch = branch; │ │106 - } │ │107 - } │ │ 95 + if (patch_data.selectedThread() != null) patch_data.repo_source = target_source;│ │ 96 }, │ │ 97 }; │ │ 98 patch_data.repo_id = target_id; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │122 const location = ui.RoutablePage.RepoLocation{ .fork = .{ │ │123 .identity = identity.identity, │ │124 .id = &id_hex, │ │137 - .target_branch = target_branch, │ │125 } }; │ │126 const files = try Files.init(.xit, .{}, arena, &fork_repo, io, arena.child_allocator, location, requested_ref, requested_value, files_path, files_line); │ │127 const commits = try Commits.init(.xit, .{}, arena, &fork_repo, io, arena.child_allocator, haxy_moment, location, requested_ref, requested_value, commits_content, commits_base_oid);│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭──────────────────────────────────────────────────────╮ │35 attachments: []const Attachment.WithId = &.{},│ │36 draft: bool = false, │ │37 fork_oid: []const u8 = "", │ │38 - target_branch: []const u8 = "", │ │38 no_changes: bool = false, │ │39 fork_exists: bool = false, │ │40 }; │ ╰──────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────╮ │59 tags: ?FieldConflict = null, │ │60 status: ?FieldConflict = null, │ │61 revision: ?FieldConflict = null, │ │62 + target_branch: ?FieldConflict = null, │ │63 description: ?struct { │ │64 chunks: []const diff3.Chunk, │ │65 ours_author: ui.Author = .unknown,│ ╰──────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │84 │ │85 // "owner/name", so the view can build /repo/owner/name/patches/... links. │ │86 identity: []const u8, │ │87 +default_target_branch: []const u8 = "", │ │88 // the url-encoded tag the lists are filtered to ("" = unfiltered). │ │89 tag: []const u8, │ │90 // the hex event id of the patch its status's window is rooted at ("" = the│ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────╮ │176 title: []const u8, │ │177 tags: []const u8, │ │178 description: []const u8, │ │179 + target_branch: []const u8, │ │180 ) ![evt.event_id_size * 2]u8 { │ │181 if (!evt.Patch.fieldsValid(title, tags)) return error.InvalidFields;│ │182 const io = session.io orelse return error.NotFound; │ ╰─────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │184 const admin_repo = session.admin_repo orelse return error.NotFound; │ │185 const user_id = session.userId() orelse return error.NotFound; │ │186 const repo_id = data.repo_id orelse return error.NotFound; │ │187 + const repo_source = data.repo_source orelse return error.NotFound; │ │188 const author = (try session.eventAuthor()) orelse return error.NotFound; │ │189 + if (!try repo_source.hasBranch(io, allocator, target_branch)) return error.InvalidFields;│ │190 var id_bytes: [evt.event_id_size]u8 = undefined; │ │191 io.random(&id_bytes); │ │192 const id = std.fmt.bytesToHex(id_bytes, .lower); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯