╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │273 return ui.RoutablePage.repoCommitsRoute(identity, .object, entry.revision_oid, 0, "", entry.base_oid) orelse error.RouteTooLong; │ │274 } │ │275 │ │276 -pub fn diffRoute(allocator: std.mem.Allocator, identity: []const u8, entry: PatchWithId) !?ui.RoutablePage { │ │277 - // merged patches show what actually landed, including conflict resolutions │ │278 - if (entry.record.event.status == .merged) { │ │279 - return ui.RoutablePage.repoPatchRevDiffRoute(identity, &entry.record.event.status.merged.patchrev_id, 0, "") orelse error.RouteTooLong;│ │280 - } │ │281 - const route = (try commitsRoute(allocator, identity, entry)) orelse return null; │ │282 - return switch (route) { │ │283 - .fork_commits => ui.RoutablePage.forkDiffRoute(identity, entry.id, 0, ""), │ │284 - .repo_commits => |c| ui.RoutablePage.repoDiffRoute(identity, c.ref_or_oid, c.value.slice(), 0, "", c.base_oid.slice()), │ │285 - else => unreachable, │ │286 - } orelse error.RouteTooLong; │ │276 +pub fn diffRoute(identity: []const u8, entry: PatchWithId) !?ui.RoutablePage { │ │277 + const patch = entry.record.event; │ │278 + const revision_id = switch (patch.status) { │ │279 + // merged patches show what actually landed, including conflict resolutions │ │280 + .merged => |merged| merged.patchrev_id, │ │281 + .open, .closed => blk: { │ │282 + if (entry.fork_exists) return ui.RoutablePage.forkDiffRoute(identity, entry.id, 0, "") orelse error.RouteTooLong; │ │283 + if (patch.source_branch == null) return null; │ │284 + break :blk (patch.revision orelse return null).id; │ │285 + }, │ │286 + }; │ │287 + return ui.RoutablePage.repoPatchRevDiffRoute(identity, &revision_id, 0, "") orelse error.RouteTooLong; │ │288 } │ │289 │ │290 pub fn draftsRoute(identity: []const u8) ?ui.RoutablePage { │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯