╭ changed ────╮ │src/patch.zig│ ╰─────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────╮ │24 title: []const u8, │ │25 tags: []const u8, │ │26 description: []const u8, │ │27 + target_branch: []const u8,│ │28 author: evt.CommitAuthor, │ │29 timestamp: u64, │ │30 }; │ ╰──────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────╮ │150 patch.title = input.title; │ │151 patch.tags = input.tags; │ │152 patch.description = input.description; │ │153 + if (!std.mem.eql(u8, patch.target_branch, input.target_branch)) patch.revision = null; │ │154 + patch.target_branch = input.target_branch; │ │155 try evt.consume(.fork, .xit, repo_opts, io, allocator, &fork_repo, evt.events_ref, &.{.{│ │156 .id = input.id, │ │157 .timestamp = input.timestamp, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │185 } │ │186 const selected = patch_record.event.revision orelse return error.PatchNotPushed; │ │187 const revision_id = try evt.parseEventId(&selected.id); │ │185 - const target_ref = rf.Ref.initFromPath(selected.target_ref, null) orelse return error.InvalidPatch;│ │186 - switch (target_ref.kind) { │ │187 - .head => {}, │ │188 - else => return error.InvalidPatch, │ │189 - } │ │188 + const target_ref = rf.Ref{ .kind = .head, .name = patch_record.event.target_branch }; │ │189 │ │190 // open and lock the fork │ │191 const fork_path = try fork.forkPath(arena.allocator(), repo_root_path, &input.id); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────╮ │438 const revisions = try DB.HashMap(.read_only).init(revisions_cursor); │ │439 var events_ref_buffer: [rf.MAX_REF_CONTENT_SIZE]u8 = undefined; │ │440 const events_ref_path = try evt.events_ref.toPath(&events_ref_buffer);│ │441 + const heads_prefix = "refs/heads/"; │ │442 for (updates) |update| { │ │443 - if (!std.mem.startsWith(u8, update.ref_name, "refs/heads/") or │ │443 + if (!std.mem.startsWith(u8, update.ref_name, heads_prefix) or │ │444 std.mem.eql(u8, update.ref_name, events_ref_path) or │ │445 std.mem.eql(u8, update.old_oid, update.new_oid)) continue; │ │446 if (update.old_oid.len != hash.hexLen(repo_opts.hash) or │ ╰───────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │458 var revision_key_buffer: [rf.MAX_REF_CONTENT_SIZE + 1 + hash.hexLen(repo_opts.hash)]u8 = undefined; │ │459 while (try commits.next(arena.allocator())) |commit| { │ │460 defer commit.deinit(); │ │461 - const key = try std.fmt.bufPrint(&revision_key_buffer, "{s}\x00{s}", .{ update.ref_name, &commit.oid }); │ │461 + const key = try std.fmt.bufPrint(&revision_key_buffer, "{s}\x00{s}", .{ update.ref_name[heads_prefix.len..], &commit.oid });│ │462 const ids_cursor = try revisions.getCursor(hash.hashInt(repo_opts.hash, key)) orelse continue; │ │463 const ids = try DB.CountedHashSet(.read_only).init(ids_cursor); │ │464 var ids_iter = try ids.iterator(); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯