╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Refs.zig ─────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
451 return page_arena.allocator().print("a:{s}", .{url}); 452 } 453 454 // the "a:" link to the files tab at ref `name` (a branch or tag) within 455 // `identity` ("owner:name"), at its root directory. the name is percent-encoded 456 // since it can contain a '/'. 457 fn refLink(page_arena: *std.heap.ArenaAllocator, identity: []const u8, kind: ui.RoutablePage.RefKind, name: []const u8) ![]const u8 { 458 const aa = page_arena.allocator(); 459 const ref_or_oid: ui.RoutablePage.RefOrOid = switch (kind) { 460 .branch => .branch, 461 .tag => .tag, 462 }; 463 const value = try ui.urlEncodeRef(aa, name); 464 const route = ui.RoutablePage.repoFilesRoute(identity, ref_or_oid, value, "", 0) orelse return error.RouteTooLong; 465 const url = try route.toUrl(page_arena); 466 return aa.print("a:{s}", .{url}); 467 } 468