╭ changed ──────────────╮ │src/ui/Repo/Patches.zig│ ╰───────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │531 .author = try ui.Author.initFromEmail(admin_moment, arena, patch.author_email), │ │532 .draft = true, │ │533 .revision_ready = revision_ready, │ │534 + .fork_oid = try aa.dupe(u8, &fork_oid), │ │535 + .target_branch = try aa.dupe(u8, target_branch), │ │536 + .no_changes = if (target_oid) |oid| std.mem.eql(u8, &oid, &fork_oid) else false,│ │537 }); │ │538 } │ │539 return .{ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────╮ │547 pub const View = Threads.View(.patch, Self); │ │548 │ │549 pub const Header = Threads.Header; │ │550 + │ │551 +pub fn cloneDirectoryName(allocator: std.mem.Allocator, title: []const u8) ![]const u8 { │ │552 + var name: [64]u8 = undefined; │ │553 + var len: usize = 0; │ │554 + var pending: ?u8 = null; │ │555 + │ │556 + for (title) |char| { │ │557 + if (std.ascii.isAlphanumeric(char)) { │ │558 + const needed: usize = if (pending == null) 1 else 2; │ │559 + if (len + needed > name.len) break; │ │560 + if (pending) |value| { │ │561 + name[len] = value; │ │562 + len += 1; │ │563 + } │ │564 + name[len] = std.ascii.toLower(char); │ │565 + len += 1; │ │566 + pending = null; │ │567 + } else if (char == ' ') { │ │568 + if (len != 0) pending = '-'; │ │569 + } else if (char == '.') { │ │570 + if (len != 0 and pending != '-') pending = '.'; │ │571 + } │ │572 + } │ │573 + if (len == 0) return ""; │ │574 + return allocator.dupe(u8, name[0..len]); │ │575 +} │ │576 │ │577 // tabs switching between the patches page's views │ │578 pub fn initHeader(allocator: std.mem.Allocator, session: *ui.Session, data: *const Self) !Header {│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯