╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────╮ │390 fork: struct { │ │391 identity: []const u8, │ │392 id: []const u8, │ │393 - target_branch: []const u8, │ │393 }, │ │394 │ │395 pub fn dupe(self: RepoLocation, allocator: std.mem.Allocator) !RepoLocation {│ ╰──────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │398 .fork => |f| .{ .fork = .{ │ │399 .identity = try allocator.dupe(u8, f.identity), │ │400 .id = try allocator.dupe(u8, f.id), │ │402 - .target_branch = try allocator.dupe(u8, f.target_branch),│ │401 } }, │ │402 }; │ │403 } │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1586 pub fn localInitOpts(self: RepoSource) rp.InitOpts { │ │1587 return .{ .path = self.path, .global_config_path = self.global_config_path }; │ │1588 } │ │1589 + │ │1590 + pub fn hasBranch(self: RepoSource, io: std.Io, allocator: std.mem.Allocator, branch: []const u8) !bool { │ │1591 + if (!xit.ref.validateName(branch)) return false; │ │1592 + return switch (self.repo_kind) { │ │1593 + inline else => |repo_kind| blk: { │ │1594 + var any_repo = try rp.AnyRepo(repo_kind, .{}).open(io, allocator, self.localInitOpts()); │ │1595 + defer any_repo.deinit(io, allocator); │ │1596 + break :blk switch (any_repo) { │ │1597 + inline else => |*repo| (try repo.readRef(io, .{ .kind = .head, .name = branch })) != null,│ │1598 + }; │ │1599 + }, │ │1600 + }; │ │1601 + } │ │1602 }; │ │1603 │ │1604 // events created in local mode have no account behind them, so the commit │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯