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