╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │1518 │ │1519 return .{ .owner = owner, .name = name }; │ │1520 } │ │1521 + │ │1522 +pub const ResolveRepoOptions = struct { │ │1523 + create: ?CreateOptions = null, │ │1524 │ │1525 + pub const CreateOptions = struct { │ │1526 + read_access: Repo.Access = .private, │ │1527 + }; │ │1528 +}; │ │1529 + │ │1530 // resolve a pushed `<owner>/<repo>` to the hex event id that names its on-disk│ │1531 // directory under the repos dir │ │1532 pub fn resolveOrCreateRepo( │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1535 admin_repo_path: []const u8, │ │1536 owner_name: []const u8, │ │1537 repo_name: []const u8, │ │1530 - create_if_missing: bool, │ │1538 + options: ResolveRepoOptions, │ │1539 ) !?[event_id_size * 2]u8 { │ │1540 var repo = rp.Repo(.xit, admin_repo_opts).open(io, allocator, .{ .path = admin_repo_path }) catch |err| switch (err) {│ │1541 error.RepoNotFound => return null, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │1554 return std.fmt.bytesToHex(found.event_id, .lower); │ │1555 } │ │1556 │ │1549 - if (!create_if_missing) return null; │ │1557 + const create_options = options.create orelse return null; │ │1558 │ │1559 // the new repo is owned by the named user, read from the name index; an│ │1560 // unknown owner can't own a repo, so the push is rejected │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────╮ │1578 .user_id = &owner_user_id, │ │1579 .name = repo_name, │ │1580 .description = "", │ │1581 + .read_access = create_options.read_access,│ │1582 } }, │ │1583 }}); │ │1584 │ ╰────────────────────────────────────────────────────────────╯ ╭ changed ───────────╮ │src/serve_common.zig│ ╰────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │20 create_if_missing: bool, │ │21 ) !RepoPath { │ │22 const owner_repo = evt.parseOwnerRepoPath(requested) orelse return .invalid; │ │23 - const event_id_hex = (try evt.resolveOrCreateRepo(io, allocator, admin_repo_path, owner_repo.owner, owner_repo.name, create_if_missing)) orelse return .not_found;│ │23 + const event_id_hex = (try evt.resolveOrCreateRepo(io, allocator, admin_repo_path, owner_repo.owner, owner_repo.name, .{ │ │24 + .create = if (create_if_missing) .{} else null, │ │25 + })) orelse return .not_found; │ │26 return .{ .ok = try std.fs.path.join(allocator, &.{ repo_root_path, &event_id_hex }) }; │ │27 } │ │28 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────╮ │src/test/net.zig│ ╰────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1740 const admin_repo_path = try std.fs.path.join(allocator, &.{ cwd_path, data_dir_name, "admin" }); │ │1741 defer allocator.free(admin_repo_path); │ │1742 │ │1743 - const event_id_hex = (try evt.resolveOrCreateRepo(io, allocator, admin_repo_path, "admin", repo_name, create)) orelse return null;│ │1743 + const event_id_hex = (try evt.resolveOrCreateRepo(io, allocator, admin_repo_path, "admin", repo_name, .{ │ │1744 + .create = if (create) .{ .read_access = .public } else null, │ │1745 + })) orelse return null; │ │1746 return try std.fs.path.join(allocator, &.{ cwd_path, data_dir_name, "repos", &event_id_hex }); │ │1747 } │ │1748 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯