╭ changed ─────────╮ │src/event/Repo.zig│ ╰──────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │12 discuss_role: ?Role = .read, │ │13 issue_role: ?Role = .read, │ │14 patch_role: ?Role = null, │ │15 +// newline-separated names of the branches a push may not delete or force push│ │16 +protected_branches: []const u8 = "", │ │17 │ │18 // what the db stores: the event's data plus the commit-derived fields │ │19 pub const Record = struct { │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │51 }; │ │52 │ │53 pub const name_max_len = 32; │ │54 +// how many branches a repo may protect, so the branches tab stays one short page │ │55 +pub const protected_branch_max_count = 50; │ │56 + │ │57 +// the protected branch names │ │58 +pub fn protectedBranchNames(self: Self, allocator: std.mem.Allocator) ![]const []const u8 {│ │59 + var names: std.ArrayList([]const u8) = .empty; │ │60 + var lines = std.mem.splitScalar(u8, self.protected_branches, '\n'); │ │61 + while (lines.next()) |line| { │ │62 + if (line.len > 0) try names.append(allocator, line); │ │63 + } │ │64 + return try names.toOwnedSlice(allocator); │ │65 +} │ │66 │ │67 // the role a kind's tab needs for a write, or null when the tab is off or the │ │68 // kind has no tab │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯