╭ changed ──╮ │src/try.zig│ ╰───────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │253 } │ │254 │ │255 // each user's repo holds the repos they own │ │256 - const repos_path = try std.fs.path.join(arena.allocator(), &.{ server_path, "repos" }); │ │256 + const users_dir = try std.fs.path.join(arena.allocator(), &.{ server_path, "users" }); │ │257 for (user_ids, 0..) |user_id, user_index| { │ │258 - const user_repo_path = try evt.userRepoPath(arena.allocator(), repos_path, &user_id);│ │258 + const user_repo_path = try evt.userRepoPath(arena.allocator(), users_dir, &user_id); │ │259 var user_repo = try evt.initUserRepo(io, allocator, user_repo_path); │ │260 defer user_repo.deinit(io, allocator); │ │261 var owned: std.ArrayList(evt.EventWithId) = .empty; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │865 defer template_repo_dir.close(io); │ │866 │ │867 for (repo_event_ids, 0..) |id_bytes, repo_index| { │ │868 - const repo_id = std.fmt.bytesToHex(id_bytes, .lower); │ │869 - const repo_path = try std.fs.path.join(arena.allocator(), &.{ server_path, "repos", &repo_id }); │ │868 + const repo_path = try evt.repoPath(arena.allocator(), users_dir, &user_ids[repo_data[repo_index].user_index], &id_bytes);│ │869 { │ │870 var dest_dir = try cwd.createDirPathOpen(io, repo_path, .{}); │ │871 defer dest_dir.close(io); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │891 │ │892 // let the native TUI's page builders open the on-disk repos for the file tree │ │893 session.io = io; │ │895 - session.repos_dir = try std.fs.path.join(session_arena.allocator(), &.{ server_path, "repos" });│ │894 + session.users_dir = try std.fs.path.join(session_arena.allocator(), &.{ server_path, "users" });│ │895 │ │896 // leave a one-shot session for the first browser to hit the web ui, so it │ │897 // starts logged in as admin │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────╮ │1058 fn seedPatchRevision( │ │1059 io: std.Io, │ │1060 allocator: std.mem.Allocator, │ │1062 - repos_path: []const u8, │ │1061 + users_dir: []const u8, │ │1062 + forker_id: *const [evt.event_id_size]u8,│ │1063 patch_id: *const [evt.event_id_size]u8, │ │1064 title: []const u8, │ │1065 author: evt.CommitAuthor, │ ╰──────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1070 contents: []const []const u8, │ │1071 ) !void { │ │1072 const patch_hex = std.fmt.bytesToHex(patch_id.*, .lower); │ │1073 - const fork_path = try fork.forkPath(allocator, repos_path, &patch_hex); │ │1073 + const fork_path = try fork.forkPath(allocator, users_dir, forker_id, patch_id); │ │1074 defer allocator.free(fork_path); │ │1075 var fork_repo = try rp.Repo(.xit, .{}).open(io, allocator, .{ .path = fork_path, .require_repo_root = true });│ │1076 defer fork_repo.deinit(io, allocator); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1199 }, │ │1200 }; │ │1201 │ │1202 - const repos_path = try std.fs.path.join(allocator, &.{ server_path, "repos" }); │ │1203 - defer allocator.free(repos_path); │ │1202 + const users_dir = try std.fs.path.join(allocator, &.{ server_path, "users" }); │ │1203 + defer allocator.free(users_dir); │ │1204 const patch_author = evt.CommitAuthor{ .name = "admin", .email = "admin@example.test" }; │ │1205 - var user_repo = (try evt.openUserRepo(io, allocator, repos_path, user_id)) orelse return error.NotFound;│ │1206 - defer user_repo.deinit(io, allocator); │ │1205 var patch_ids: [patch_data.len][evt.event_id_size]u8 = undefined; │ │1206 for (patch_data, 0..) |patch, i| { │ │1207 const timestamp: u64 = @intCast(500 + i * 10); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────╮ │1208 patch_ids[i] = evt.EventWithId.randomId(random); │ │1209 const patch_hex = std.fmt.bytesToHex(patch_ids[i], .lower); │ │1212 - const path = try fork.create(.{}, io, allocator, repos_path, &user_repo, .{│ │1210 + const path = try fork.create(.{}, io, allocator, users_dir, .{ │ │1211 .id = patch_hex, │ │1212 .user_id = user_id.*, │ │1213 .repo_id = repo_id.*, │ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1253 } │ │1254 break :blk .{ "patch.txt", contents.len }; │ │1255 }; │ │1258 - try seedPatchRevision(io, allocator, repos_path, &patch_ids[i], patch.title, patch_author, timestamp + 1, random, base_oid, file_path, contents[0..count]); │ │1256 + try seedPatchRevision(io, allocator, users_dir, user_id, &patch_ids[i], patch.title, patch_author, timestamp + 1, random, base_oid, file_path, contents[0..count]);│ │1257 } │ │1258 const status = patch.status orelse continue; │ │1261 - const fork_path = try fork.forkPath(allocator, repos_path, &patch_hex); │ │1262 - defer allocator.free(fork_path); │ │1263 - try pch.publish(.{}, io, allocator, admin_repo, &user_repo, target_repo, fork_path, .{ │ │1259 + try pch.publish(.{}, io, allocator, users_dir, admin_repo, target_repo, .{ │ │1260 .id = patch_hex, │ │1261 .user_id = user_id.*, │ │1262 .repo_id = repo_id.*, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────╮ │1265 }); │ │1266 │ │1267 if (status == .merged) { │ │1272 - try pch.mergeAndRemoveFork(.{}, io, allocator, repos_path, target_repo, .{│ │1268 + try pch.mergeAndRemoveFork(.{}, io, allocator, users_dir, target_repo, .{ │ │1269 .id = patch_hex, │ │1270 .revision = .source, │ │1271 .author = patch_author, │ ╰────────────────────────────────────────────────────────────────────────────────────────────╯