╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭────────────────────────────────────────────────────────╮ │586 arena: *std.heap.ArenaAllocator, │ │587 admin_moment: ?evt.AdminDB.HashMap(.read_only),│ │588 repo: *rp.Repo(repo_kind, repo_opts), │ │577 - default_target_branch: []const u8, │ │589 target: *Window, │ │590 ) !void { │ │591 if (target.items.len == 0) return; │ ╰────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │596 const record = try evt.Fork.readById(evt.AdminDB, evt.admin_repo_opts.hash, moment, arena, &id);│ │597 item.fork_exists = if (record) |value| !value.removed else false; │ │598 } │ │588 - const revision = item.record.event.revision orelse { │ │589 - if (item.fork_exists) item.target_branch = default_target_branch; │ │590 - continue; │ │591 - }; │ │592 - const target_branch = revision.targetBranch() orelse continue; │ │599 + const target_branch = item.record.event.target_branch; │ │600 + const revision = item.record.event.revision orelse continue; │ │601 item.fork_oid = switch (item.record.event.status) { │ │602 .merged => |oid| oid, │ │603 else => revision.source_oid, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │604 }; │ │597 - item.target_branch = target_branch; │ │605 if (item.record.event.status.kind() == .merged) continue; │ │606 const target_oid = try repo.readRef(io, .{ .kind = .head, .name = target_branch }); │ │607 item.no_changes = if (target_oid) |oid| std.mem.eql(u8, &oid, revision.source_oid) else false;│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────╮ │618 repo_id: *const [evt.event_id_size]u8, │ │619 selected_id: []const u8, │ │620 target_repo: *rp.Repo(repo_kind, repo_opts), │ │614 - default_target_branch: []const u8, │ │621 ) !Window { │ │622 const user_id = session.data.user_id orelse return .empty;│ │623 if (user_id.len != evt.event_id_size) return .empty; │ ╰───────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │669 const path = try fork.forkPath(aa, repos_dir, &id_hex); │ │670 var fork_repo = rp.Repo(.xit, .{}).open(io, arena.child_allocator, .{ .path = path, .require_repo_root = true }) catch continue; │ │671 defer fork_repo.deinit(io, arena.child_allocator); │ │666 - const entry = (try loadDraftEntry(repo_kind, repo_opts, arena, io, admin_moment, &fork_repo, target_repo, id, default_target_branch)) orelse continue;│ │672 + const entry = (try loadDraftEntry(repo_kind, repo_opts, arena, io, admin_moment, &fork_repo, target_repo, id)) orelse continue; │ │673 try items.append(aa, entry); │ │674 } │ │675 return .{ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────╮ │689 fork_repo: *rp.Repo(.xit, .{}), │ │690 target_repo: *rp.Repo(repo_kind, repo_opts), │ │691 id: [evt.event_id_size]u8, │ │686 - default_target_branch: []const u8, │ │692 ) !?PatchWithId { │ │693 const aa = arena.allocator(); │ │694 const id_hex = std.fmt.bytesToHex(id, .lower);│ ╰───────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │695 const fork_oid = (try fork_repo.readRef(io, fork.ref)) orelse return null; │ │696 const moment = evt.currentMoment(.{}, fork_repo) catch return null; │ │697 const patch = (try evt.Patch.readById(evt.EventDB(.sha1), .sha1, moment, arena, &id)) orelse return null;│ │693 - var target_branch = default_target_branch; │ │694 - if (patch.event.revision) |revision| { │ │695 - target_branch = revision.targetBranch() orelse return null; │ │696 - } │ │697 - const target_oid = if (target_branch.len != 0) │ │698 - try target_repo.readRef(io, .{ .kind = .head, .name = target_branch }) │ │699 - else │ │700 - null; │ │698 + const target_branch = patch.event.target_branch; │ │699 + const target_oid = try target_repo.readRef(io, .{ .kind = .head, .name = target_branch }); │ │700 return .{ │ │701 .id = try aa.dupe(u8, &id_hex), │ │702 .record = patch, │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │703 .author = try ui.Author.initFromEmail(admin_moment, arena, patch.author_email), │ │704 .draft = true, │ │705 .fork_oid = try aa.dupe(u8, &fork_oid), │ │707 - .target_branch = try aa.dupe(u8, target_branch), │ │706 .no_changes = if (target_oid) |oid| std.mem.eql(u8, &oid, &fork_oid) else false,│ │707 .fork_exists = true, │ │708 }; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │717 pub fn appendDetails(self: *const Self, allocator: std.mem.Allocator, box: *wgt.Box(ui.Widget), session: *ui.Session, entry: Entry) !void {│ │718 const aa = session.page_arena.allocator(); │ │719 const status_kind = entry.record.event.status.kind(); │ │720 + const target_branch = entry.record.event.target_branch; │ │721 var fields: [2]ui.widget.CopyableText.Choice = undefined; │ │722 var field_count: usize = 0; │ │723 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │725 - if (status_kind != .merged and entry.fork_exists and entry.target_branch.len != 0) if (session.data.git_ssh_port) |port| { │ │726 - const url = try std.fmt.allocPrint(aa, "ssh://localhost:{d}/fork/{s}/patch:{s}/branch:{s}", .{ port, self.identity, entry.id, entry.target_branch });│ │724 + if (status_kind != .merged and entry.fork_exists) if (session.data.git_ssh_port) |port| { │ │725 + const url = try std.fmt.allocPrint(aa, "ssh://localhost:{d}/fork/{s}/patch:{s}", .{ port, self.identity, entry.id }); │ │726 const push_command = try std.fmt.allocPrint(aa, "git push {s} HEAD:patch", .{url}); │ │727 const clone_name = try cloneDirectoryName(aa, entry.record.event.title); │ │728 const clone_command = if (clone_name.len == 0) │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯