╭ changed ────────╮ │src/ui/widget.zig│ ╰─────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────╮ │29 home: ui.Home.View, │ │30 user: ui.User.View, │ │31 repo: ui.Repo.View, │ │32 + fork: ui.Fork.View, │ │33 quit: ui.Quit.View, │ │34 unauthorized: ui.Unauthorized.View,│ │35 title: ui.Title.View, │ ╰───────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────╮ │37 home_header: ui.Home.Header.View, │ │38 user_header: ui.User.Header.View, │ │39 repo_header: ui.Repo.Header.View, │ │40 + fork_header: ui.Fork.Header.View, │ │41 repo_files_header: ui.Repo.Files.Header.View, │ │42 repo_commits_header: ui.Repo.Commits.Header.View,│ │43 repo_issues_header: ui.Repo.Issues.Header, │ ╰─────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1260 return .{ .box = box, .session = session, .choices = owned_choices }; │ │1261 } │ │1262 │ │1261 - pub fn initClone(allocator: std.mem.Allocator, session: *ui.Session, identity: []const u8) !CopyableText { │ │1263 + pub fn initClone(allocator: std.mem.Allocator, session: *ui.Session, location: ui.RoutablePage.RepoLocation) !?CopyableText {│ │1264 const aa = session.page_arena.allocator(); │ │1265 var choices: [2]Choice = undefined; │ │1266 var count: usize = 0; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1265 - if (session.data.git_http_port) |port| { │ │1266 - const url = try std.fmt.allocPrint(aa, "http://localhost:{d}/repo/{s}", .{ port, identity }); │ │1267 - choices[count] = .{ │ │1268 - .selector = "http", │ │1269 - .text = url, │ │1270 - .copyable_text = try std.fmt.allocPrint(aa, "git clone {s}", .{url}), │ │1271 - .label = " clone ", │ │1272 - }; │ │1273 - count += 1; │ │1267 + switch (location) { │ │1268 + .repo => |identity| { │ │1269 + if (session.data.git_http_port) |port| { │ │1270 + const url = try std.fmt.allocPrint(aa, "http://localhost:{d}/repo/{s}", .{ port, identity }); │ │1271 + choices[count] = .{ │ │1272 + .selector = "http", │ │1273 + .text = url, │ │1274 + .copyable_text = try std.fmt.allocPrint(aa, "git clone {s}", .{url}), │ │1275 + .label = " clone ", │ │1276 + }; │ │1277 + count += 1; │ │1278 + } │ │1279 + if (session.data.git_ssh_port) |port| { │ │1280 + const url = try std.fmt.allocPrint(aa, "ssh://localhost:{d}/repo/{s}", .{ port, identity }); │ │1281 + choices[count] = .{ │ │1282 + .selector = "ssh", │ │1283 + .text = url, │ │1284 + .copyable_text = try std.fmt.allocPrint(aa, "{s}git clone {s}", .{ session.data.git_ssh_prefix, url }), │ │1285 + .label = " clone ", │ │1286 + }; │ │1287 + count += 1; │ │1288 + } │ │1289 + }, │ │1290 + .fork => |f| if (f.target_branch.len != 0) if (session.data.git_ssh_port) |port| { │ │1291 + const url = try std.fmt.allocPrint(aa, "ssh://localhost:{d}/repo/{s}/patch:{s}/branch:{s}", .{ port, f.identity, f.id, try ui.urlEncodeRef(aa, f.target_branch) });│ │1292 + choices[count] = .{ │ │1293 + .text = url, │ │1294 + .copyable_text = try std.fmt.allocPrint(aa, "{s}git clone {s}", .{ session.data.git_ssh_prefix, url }), │ │1295 + .label = " clone ", │ │1296 + }; │ │1297 + count += 1; │ │1298 + }, │ │1299 } │ │1275 - if (session.data.git_ssh_port) |port| { │ │1276 - const url = try std.fmt.allocPrint(aa, "ssh://localhost:{d}/repo/{s}", .{ port, identity }); │ │1277 - choices[count] = .{ │ │1278 - .selector = "ssh", │ │1279 - .text = url, │ │1280 - .copyable_text = try std.fmt.allocPrint(aa, "{s}git clone {s}", .{ session.data.git_ssh_prefix, url }), │ │1281 - .label = " clone ", │ │1282 - }; │ │1283 - count += 1; │ │1284 - } │ │1285 - if (count == 0) return error.MissingGitPort; │ │1286 - return init(allocator, session, choices[0..count]); │ │1300 + if (count == 0) return null; │ │1301 + return @as(?CopyableText, try init(allocator, session, choices[0..count])); │ │1302 } │ │1303 │ │1304 pub fn minWidth(self: *const CopyableText) usize { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯