╭ changed ───────╮ │src/test/net.zig│ ╰────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │585 .title = "add a feature", │ │586 .description = "a draft patch", │ │587 .tags = "enhancement", │ │588 + .target_branch = "master", │ │589 .author = .{ .name = "admin", .email = "admin@example.test" },│ │590 .timestamp = 1, │ │591 }); │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │615 break :blk try client.commit(io, allocator, .{ .message = "add feature" }); │ │616 }; │ │617 │ │617 - const remote_url = try std.fmt.allocPrint(allocator, "git@localhost:fork/admin/target/patch:{s}/branch:master", .{&fork_id_hex});│ │618 + const remote_url = try std.fmt.allocPrint(allocator, "git@localhost:fork/admin/target/patch:{s}", .{&fork_id_hex}); │ │619 defer allocator.free(remote_url); │ │620 try client.addRemote(io, allocator, .{ .name = "patch", .value = remote_url }); │ │621 try client.push(io, allocator, "patch", "master:patch", false, .{ .wire = .{ .ssh = .{ .command = ssh_cmd } } }); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │631 try std.testing.expect(!patch.removed); │ │632 try std.testing.expectEqualStrings(&source_oid, &(try draft.readRef(io, fork.ref) orelse return error.NotFound)); │ │633 const selected = patch.event.revision orelse return error.NotFound; │ │633 - try std.testing.expectEqualStrings("refs/heads/master", selected.target_ref); │ │634 + try std.testing.expectEqualStrings("master", patch.event.target_branch); │ │635 try std.testing.expectEqualStrings(&source_oid, selected.source_oid); │ │636 first_revision_id = try evt.parseEventId(&selected.id); │ │637 const revision = (try evt.PatchRev.readById(evt.EventDB(.sha1), .sha1, moment, &arena, &first_revision_id)) orelse return error.NotFound;│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────╮ │637 - try std.testing.expectEqualStrings("refs/heads/master", revision.event.target_ref);│ │638 try std.testing.expectEqualStrings(&source_oid, revision.event.source_oid); │ │639 } │ │640 │ ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │659 defer arena.deinit(); │ │660 const moment = try evt.currentMoment(.{}, &target); │ │661 const patch = (try evt.Patch.readById(evt.EventDB(.sha1), .sha1, moment, &arena, &fork_id)) orelse return error.NotFound; │ │662 - try evt.consume(.repo, .xit, .{}, io, allocator, &target, evt.events_ref, &.{.{ │ │663 - .id = fork_id_hex, │ │664 - .timestamp = 3, │ │665 - .author = .{ .name = "admin", .email = "admin@example.test" }, │ │666 - .event = .{ .patch = .{ │ │667 - .title = "edited feature", │ │668 - .description = patch.event.description, │ │669 - .tags = patch.event.tags, │ │670 - .target_patch_id = patch.event.target_patch_id, │ │671 - .revision = patch.event.revision, │ │672 - } }, │ │673 - }}); │ │662 + try evt.Patch.update(.xit, .{}, io, allocator, &target, &fork_id, .{ .fields = .{ │ │663 + .title = "edited feature", │ │664 + .description = patch.event.description, │ │665 + .tags = patch.event.tags, │ │666 + .target_branch = "feature", │ │667 + } }, .{ .name = "admin", .email = "admin@example.test" }); │ │668 } │ │669 │ │676 - const feature_remote_url = try std.fmt.allocPrint(allocator, "git@localhost:fork/admin/target/patch:{s}/branch:feature", .{&fork_id_hex});│ │670 + const feature_remote_url = try std.fmt.allocPrint(allocator, "git@localhost:fork/admin/target/patch:{s}", .{&fork_id_hex}); │ │671 defer allocator.free(feature_remote_url); │ │672 try client.addRemote(io, allocator, .{ .name = "patch-to-feature", .value = feature_remote_url }); │ │673 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │695 @memcpy(&second_patch_oid, newest.record.patch_oid); │ │696 try std.testing.expect(!std.mem.eql(u8, &first_revision_id, &second_revision_id)); │ │697 try std.testing.expectEqualStrings(&second_source_oid, newest.record.event.source_oid); │ │704 - try std.testing.expectEqualStrings("refs/heads/feature", newest.record.event.target_ref);│ │698 try std.testing.expectEqualStrings("edited feature", newest.record.event.message); │ │699 } │ │700 { │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │708 const selected = patch.event.revision orelse return error.NotFound; │ │709 try std.testing.expectEqualStrings(&std.fmt.bytesToHex(second_revision_id, .lower), &selected.id);│ │710 try std.testing.expectEqualStrings(&second_source_oid, selected.source_oid); │ │718 - try std.testing.expectEqualStrings("refs/heads/feature", selected.target_ref); │ │711 + try std.testing.expectEqualStrings("feature", patch.event.target_branch); │ │712 } │ │713 │ │714 // │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │797 try std.testing.expectEqualStrings(&second_patch_oid, imported.patch_oid); │ │798 } │ │799 │ │807 - const other_url = try std.fmt.allocPrint(allocator, "git@localhost:fork/admin/other/patch:{s}/branch:other", .{&fork_id_hex}); │ │800 + const other_url = try std.fmt.allocPrint(allocator, "git@localhost:fork/admin/other/patch:{s}", .{&fork_id_hex}); │ │801 defer allocator.free(other_url); │ │802 try client.addRemote(io, allocator, .{ .name = "other", .value = other_url }); │ │803 const wrong_repo_rejected = if (client.push(io, allocator, "other", "master:patch", false, .{ .wire = .{ .ssh = .{ .command = ssh_cmd } } })) |_| false else |_| true;│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │854 }); │ │855 } │ │856 │ │864 - const denied_url = try std.fmt.allocPrint(allocator, "git@localhost:fork/admin/target/patch:{s}/branch:denied", .{&fork_id_hex}); │ │857 + const denied_url = try std.fmt.allocPrint(allocator, "git@localhost:fork/admin/target/patch:{s}", .{&fork_id_hex}); │ │858 defer allocator.free(denied_url); │ │859 try client.addRemote(io, allocator, .{ .name = "denied", .value = denied_url }); │ │860 const unauthorized_rejected = if (client.push(io, allocator, "denied", "master:patch", false, .{ .wire = .{ .ssh = .{ .command = ssh_cmd } } })) |_| false else |_| true;│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯