╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Commits.zig ──────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
822 const route = pageRoute(data, oid) orelse return error.RouteTooLong; 823 const url = try route.toUrl(page_arena); 824 return page_arena.allocator().print("a:{s}", .{url}); 825 } 826 827 // the "a:" link to the files tab at commit `oid` (an object ref), at its root 828 // directory, within `location`. 829 fn filesObjectLink(page_arena: *std.heap.ArenaAllocator, location: ui.RoutablePage.RepoLocation, oid: []const u8) ![]const u8 { 830 const route = location.filesRoute(.object, oid, "", 0) orelse return error.RouteTooLong; 831 const url = try route.toUrl(page_arena); 832 return page_arena.allocator().print("a:{s}", .{url}); 833 } 834 835 // the in-page "ai:" anchor for selecting a commit, showing its whole message 836 // when `message` is set. the href is only followed with js off. 837 fn commitRowLink(page_arena: *std.heap.ArenaAllocator, data: *const Self, commit: Commit, message: bool) ![]const u8 { 838 // a result roots the same results page at its commit, so the query 839 // survives following the row 840 if (data.search != null) { 841 const route = pageRoute(data, commit.oid) orelse return error.RouteTooLong; 842 return page_arena.allocator().print("ai:{s}", .{try route.toUrl(page_arena)}); 843 } 844 const route = (if (message) 845 data.handle.location.commitMessageRoute(.object, commit.oid, data.base_oid) 846 else 847 data.handle.location.commitsRoute(.object, commit.oid, data.base_oid)) orelse return error.RouteTooLong; 848 const url = try route.toUrl(page_arena); 849 return page_arena.allocator().print("ai:{s}", .{url}); 850 } 851 852 // the "a:" link to the page showing `oid`'s message on its own. 853 fn messageLink(page_arena: *std.heap.ArenaAllocator, data: *const Self, oid: []const u8) ![]const u8 { 854 const route = data.handle.location.commitMessageRoute(.object, oid, data.base_oid) orelse return error.RouteTooLong; 855 const url = try route.toUrl(page_arena); 856 return page_arena.allocator().print("a:{s}", .{url}); 857 } 858