╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ──────────╮ │src/event/Patch.zig│ ╰───────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │233 const revisions = try DB.HashMap(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, revision_to_id_set_key)));│ │234 for ([_][]const u8{ revision.squash_oid, revision.source_oid }, 0..) |oid, i| { │ │235 if (i != 0 and std.mem.eql(u8, revision.squash_oid, revision.source_oid)) continue; │ │245 - const key_hash = hash.hashInt(hash_kind, try revisionKey(arena.allocator(), revision.target_ref, oid)); │ │236 + const key_hash = hash.hashInt(hash_kind, try revisionKey(arena.allocator(), existing.event.target_branch, oid)); │ │237 const ids = try DB.CountedHashSet(.read_write).init(try revisions.putCursor(key_hash)); │ │238 _ = try ids.remove(record_key); │ │239 if (try ids.count() == 0) _ = try revisions.remove(key_hash); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │276 const revisions = try DB.HashMap(.read_write).init(try haxy_moment.putCursor(hash.hashInt(hash_kind, revision_to_id_set_key)));│ │277 for ([_][]const u8{ revision.squash_oid, revision.source_oid }, 0..) |oid, i| { │ │278 if (i != 0 and std.mem.eql(u8, revision.squash_oid, revision.source_oid)) continue; │ │288 - const key = try revisionKey(arena.allocator(), revision.target_ref, oid); │ │279 + const key = try revisionKey(arena.allocator(), record.event.target_branch, oid); │ │280 const ids = try DB.CountedHashSet(.read_write).init(try revisions.putCursor(hash.hashInt(hash_kind, key))); │ │281 try ids.put(record_key, .{ .bytes = event_id }); │ │282 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │330 }; │ │331 }, │ │332 .fields => |fields| { │ │333 + if (!rf.validateName(fields.target_branch)) return error.InvalidFields; │ │334 + if ((try repo.readRef(io, .{ .kind = .head, .name = fields.target_branch })) == null) return error.InvalidFields;│ │335 updated.title = fields.title; │ │336 updated.tags = fields.tags; │ │337 updated.description = fields.description; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │338 + if (!std.mem.eql(u8, updated.target_branch, fields.target_branch)) updated.revision = null; │ │339 + updated.target_branch = fields.target_branch; │ │340 }, │ │341 .resolve => |resolve| { │ │342 updated = try resolveFields(repo_kind, repo_opts, io, allocator, &arena, repo, id, record, resolve);│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │385 const their_cursor = (try entry.getCursor(hash.hashInt(repo_opts.hash, evt.their_record_key))) orelse return updated; │ │386 const theirs = try evt.read(Record, DB, repo_opts.hash, arena, try DB.HashMap(.read_only).init(their_cursor)); │ │387 │ │388 + const original_target_branch = updated.target_branch; │ │389 var field_iter = std.mem.splitScalar(u8, fields, ' '); │ │390 while (field_iter.next()) |field| { │ │391 if (std.mem.eql(u8, field, "status") and fieldListed(resolve.theirs, ',', field)) updated.status = theirs.event.status;│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │392 if (std.mem.eql(u8, field, "revision") and fieldListed(resolve.theirs, ',', field)) updated.revision = theirs.event.revision; │ │393 + if (std.mem.eql(u8, field, "target_branch") and fieldListed(resolve.theirs, ',', field)) updated.target_branch = theirs.event.target_branch;│ │394 } │ │395 + if (!std.mem.eql(u8, original_target_branch, updated.target_branch)) updated.revision = null; │ │396 │ │397 if (!fieldListed(fields, ' ', "description")) return updated; │ │398 var base_description: []const u8 = ""; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────╮ │440 return readById(evt.EventDB(repo_opts.hash), repo_opts.hash, moment, arena, id); │ │441 } │ │442 │ │445 -fn revisionKey(allocator: std.mem.Allocator, target_ref: []const u8, oid: []const u8) ![]u8 { │ │446 - return std.mem.concat(allocator, u8, &.{ target_ref, "\x00", oid }); │ │443 +fn revisionKey(allocator: std.mem.Allocator, target_branch: []const u8, oid: []const u8) ![]u8 {│ │444 + return std.mem.concat(allocator, u8, &.{ target_branch, "\x00", oid }); │ │445 } │ │446 │ │447 fn statusSet( │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ─────────────╮ │src/event/PatchRev.zig│ ╰──────────────────────╯ ╭───────────────────────────────╮ │ 7 │ │ 8 base_oid: []const u8, │ │ 9 source_oid: []const u8, │ │10 -target_ref: []const u8, │ │10 message: []const u8, │ │11 │ │12 pub const Record = struct {│ ╰───────────────────────────────╯ ╭─────────────────────────────────────────────────────────────╮ │115 │ │116 try validateOid(hash_kind, record.event.base_oid); │ │117 try validateOid(hash_kind, record.event.source_oid);│ │119 - try validateTarget(record.event.target_ref); │ │118 try validateOid(hash_kind, record.event_oid); │ │119 try validateOid(hash_kind, record.base_tree_oid); │ │120 try validateOid(hash_kind, record.head_tree_oid); │ ╰─────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────╮ │123 if (existing_maybe) |existing| { │ │124 if (!std.mem.eql(u8, existing.event.base_oid, record.event.base_oid) or │ │125 !std.mem.eql(u8, existing.event.source_oid, record.event.source_oid) or│ │128 - !std.mem.eql(u8, existing.event.target_ref, record.event.target_ref) or│ │126 !std.mem.eql(u8, existing.event.message, record.event.message) or │ │127 !std.mem.eql(u8, existing.base_tree_oid, record.base_tree_oid) or │ │128 !std.mem.eql(u8, existing.head_tree_oid, record.head_tree_oid) or │ ╰────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯