╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ───────────────╮ │src/test/event/patch.zig│ ╰────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1006 // edit the patch metadata in the fork │ │1007 // │ │1008 │ │1009 - try std.testing.expect(try pch.editDraft(repo_opts, io, allocator, &admin, &user_repo, draft_path, .{│ │1009 + try std.testing.expect(try pch.editDraft(repo_opts, io, allocator, users_dir, &admin, .{ │ │1010 .id = patch_id_hex, │ │1011 .user_id = user_id, │ │1012 .repo_id = repo_id, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │1023 // │ │1024 │ │1025 const before_publish = try target.core.db.rootCursor().count(); │ │1026 - try pch.publish(repo_opts, io, allocator, &admin, &user_repo, &target, draft_path, .{│ │1026 + try pch.publish(repo_opts, io, allocator, users_dir, &admin, &target, .{ │ │1027 .id = patch_id_hex, │ │1028 .user_id = user_id, │ │1029 .repo_id = repo_id, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮ │1031 .timestamp = 5, │ │1032 }); │ │1033 try std.testing.expectEqual(before_publish + 1, try target.core.db.rootCursor().count());│ │1034 - try pch.publish(repo_opts, io, allocator, &admin, &user_repo, &target, draft_path, .{ │ │1034 + try pch.publish(repo_opts, io, allocator, users_dir, &admin, &target, .{ │ │1035 .id = patch_id_hex, │ │1036 .user_id = user_id, │ │1037 .repo_id = repo_id, │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1083 // │ │1084 │ │1085 try evt.Patch.update(.server, .xit, repo_opts, io, allocator, &target, &patch_id, .{ .status = .closed }, author);│ │1086 - try std.testing.expectError(error.PatchClosed, pch.merge(repo_opts, io, allocator, repos_dir, &target, .{ │ │1086 + try std.testing.expectError(error.PatchClosed, pch.merge(repo_opts, io, allocator, users_dir, &target, .{ │ │1087 .id = patch_id_hex, │ │1088 .revision = merge_revision, │ │1089 .author = author, │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1093 │ │1094 // run the cache scenario once; both lifecycle runs still perform a merge │ │1095 if (merge_revision == .source) { │ │1096 - try testMergeability(&target, io, allocator, repos_dir, &patch_id, &base_oid, &source_oid); │ │1096 + try testMergeability(&target, io, allocator, users_dir, &user_id, &patch_id, &base_oid, &source_oid);│ │1097 } │ │1098 │ │1099 const selected_oid = switch (merge_revision) { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │1100 .squash => squash_oid, │ │1101 .source => source_oid, │ │1102 }; │ │1103 - try pch.mergeAndRemoveFork(repo_opts, io, allocator, repos_dir, &target, .{│ │1103 + try pch.mergeAndRemoveFork(repo_opts, io, allocator, users_dir, &target, .{│ │1104 .id = patch_id_hex, │ │1105 .revision = merge_revision, │ │1106 .author = author, │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────╮ │1183 target: *Repo, │ │1184 io: std.Io, │ │1185 allocator: std.mem.Allocator, │ │1186 - repos_dir: []const u8, │ │1186 + users_dir: []const u8, │ │1187 + forker_id: *const [evt.event_id_size]u8, │ │1188 id: *const [evt.event_id_size]u8, │ │1189 base: *const [hash.hexLen(repo_opts.hash)]u8, │ │1190 source: *const [hash.hexLen(repo_opts.hash)]u8,│ ╰─────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1220 var squash_input = input; │ │1221 squash_input.revision = .squash; │ │1222 try std.testing.expectEqualDeep(pch.Mergeability{}, try readMergeability(target, io, allocator, id, patch)); │ │1222 - try std.testing.expectError(error.MergeCheckUnavailable, pch.merge(repo_opts, io, allocator, repos_dir, target, input)); │ │1223 - try std.testing.expectError(error.MergeCheckUnavailable, pch.merge(repo_opts, io, allocator, repos_dir, target, squash_input));│ │1223 + try std.testing.expectError(error.MergeCheckUnavailable, pch.merge(repo_opts, io, allocator, users_dir, target, input)); │ │1224 + try std.testing.expectError(error.MergeCheckUnavailable, pch.merge(repo_opts, io, allocator, users_dir, target, squash_input));│ │1225 │ │1226 // local edits and server comments leave checks alone │ │1227 var edit = evt.Patch.Update{ .fields = .{ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1243 const events_before = try target.readRef(io, evt.events_ref); │ │1244 try std.testing.expectEqualDeep(pch.Mergeability{ .source = .conflict, .squash = .conflict }, try readMergeability(target, io, allocator, id, patch));│ │1245 try expectMergeabilityShortBytes(try target.core.latestMoment(), id); │ │1245 - try std.testing.expectError(error.MergeConflict, pch.merge(repo_opts, io, allocator, repos_dir, target, input)); │ │1246 - try std.testing.expectError(error.MergeConflict, pch.merge(repo_opts, io, allocator, repos_dir, target, squash_input)); │ │1246 + try std.testing.expectError(error.MergeConflict, pch.merge(repo_opts, io, allocator, users_dir, target, input)); │ │1247 + try std.testing.expectError(error.MergeConflict, pch.merge(repo_opts, io, allocator, users_dir, target, squash_input)); │ │1248 try std.testing.expectEqual(events_before, try target.readRef(io, evt.events_ref)); │ │1249 try std.testing.expectEqual(conflicting_target, (try target.readRef(io, .{ .kind = .head, .name = "master" })).?); │ │1250 try std.testing.expectEqual(null, try target.readRef(io, .{ .kind = .none, .name = "MERGE_HEAD" })); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1267 try std.testing.expectEqualDeep(clean, try readMergeability(target, io, allocator, id, patch));│ │1268 │ │1269 // a missing fork disables merging without changing the accepted events │ │1269 - const draft_path = try fork.forkPath(allocator, repos_dir, &std.fmt.bytesToHex(id.*, .lower)); │ │1270 + const draft_path = try fork.forkPath(allocator, users_dir, forker_id, id); │ │1271 defer allocator.free(draft_path); │ │1272 const away_path = try std.fmt.allocPrint(allocator, "{s}.away", .{draft_path}); │ │1273 defer allocator.free(away_path); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯