╭ changed ───╮ │src/fork.zig│ ╰────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │146 else => |other| return other, │ │147 }; │ │148 │ │149 - _ = try moment.remove(hash.hashInt(repo_opts.hash, "haxy")); │ │150 - _ = try moment.remove(hash.hashInt(repo_opts.hash, "haxy-last-object-id")); │ │149 + _ = try moment.remove(hash.hashInt(repo_opts.hash, evt.materialized_key)); │ │150 + _ = try moment.remove(hash.hashInt(repo_opts.hash, evt.last_object_id_key)); │ │151 │ │152 if (head_oid_maybe) |*head_oid| { │ │153 try rf.write(.xit, repo_opts, state, ctx.io, patch_path, .{ .oid = head_oid });│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │232 if (!std.mem.eql(u8, patch.author_email orelse "", author.email)) return error.PatchDataUnavailable; │ │233 if (patch.event.status == .merged) return error.PatchAlreadyMerged; │ │234 } │ │235 - const published = target_patch != null; │ │235 + const posted = target_patch != null; │ │236 const title = if (target_patch) |patch| patch.event.title else fork_patch.event.title; │ │237 │ │238 const target_oid = (try target_repo.readRef(io, .{ .kind = .head, .name = target_branch })) orelse return error.TargetNotFound;│ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────╮ │251 writer: *std.Io.Writer, │ │252 patch_id: [evt.event_id_size * 2]u8, │ │253 patch: evt.Patch.Record, │ │254 - published: bool, │ │254 + posted: bool, │ │255 target_oid: [hash.hexLen(repo_opts.hash)]u8,│ │256 target_ref: []const u8, │ │257 title: []const u8, │ ╰─────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │287 var head_tree_oid: [hash.hexLen(repo_opts.hash)]u8 = undefined; │ │288 var tree_entries: [2]evt.EventTreeEntry = undefined; │ │289 if (existing_revision) |latest| { │ │290 - if (ctx.published) ctx.revision_id_maybe.* = latest.id; │ │290 + if (ctx.posted) ctx.revision_id_maybe.* = latest.id; │ │291 } else { │ │292 var base_object = try obj.Object(.xit, repo_opts).initCommit(state.readOnly(), ctx.io, ctx.allocator, &base_oid);│ │293 defer base_object.deinit(); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │299 var revision_id: [evt.event_id_size]u8 = undefined; │ │300 ctx.io.random(&revision_id); │ │301 const revision_hex = std.fmt.bytesToHex(revision_id, .lower); │ │302 + const revision_event: evt.PatchRev = .{ │ │303 + .base_oid = &base_oid, │ │304 + .source_oid = &source_oid, │ │305 + .target_ref = ctx.target_ref, │ │306 + .message = ctx.title, │ │307 + }; │ │308 + const identity = try std.fmt.allocPrint(ctx.allocator, "{s} <{s}>", .{ ctx.author.name, ctx.author.email });│ │309 + defer ctx.allocator.free(identity); │ │310 + const patch_oid = try evt.PatchRev.writeSquashCommit( │ │311 + .xit, │ │312 + repo_opts, │ │313 + state, │ │314 + ctx.io, │ │315 + ctx.allocator, │ │316 + revision_event, │ │317 + &head_tree_oid, │ │318 + identity, │ │319 + identity, │ │320 + ctx.timestamp, │ │321 + ); │ │322 tree_entries = .{ │ │323 .{ .tree = .{ .name = "base", .oid = &base_tree_oid } }, │ │324 .{ .tree = .{ .name = "head", .oid = &head_tree_oid } }, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────╮ │328 .timestamp = ctx.timestamp, │ │329 .author = ctx.author, │ │330 .tree_entries = &tree_entries, │ │311 - .event = .{ .patchrev = .{ │ │312 - .base_oid = &base_oid, │ │313 - .source_oid = &source_oid, │ │314 - .target_ref = ctx.target_ref, │ │315 - .message = ctx.title, │ │316 - } }, │ │331 + .event = .{ .patchrev = revision_event },│ │332 }; │ │333 event_count += 1; │ │334 ctx.revision_id_maybe.* = revision_id; │ ╰──────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────╮ │335 │ │321 - if (!ctx.published) { │ │336 + if (!ctx.posted) { │ │337 var patch = ctx.patch.event; │ │323 - patch.patchrev_id = revision_hex;│ │338 + patch.revision = .{ │ │339 + .id = revision_hex, │ │340 + .squash_oid = &patch_oid, │ │341 + .source_oid = &source_oid, │ │342 + .target_ref = ctx.target_ref,│ │343 + }; │ │344 events[event_count] = .{ │ │345 .id = ctx.patch_id, │ │346 .timestamp = ctx.timestamp, │ ╰──────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────╮ │351 } │ │352 } │ │353 │ │334 - if (ctx.published and !ctx.patch.removed) {│ │354 + if (ctx.posted and !ctx.patch.removed) { │ │355 events[event_count] = .{ │ │356 .id = ctx.patch_id, │ │357 .timestamp = ctx.timestamp, │ ╰────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────╮ │381 .writer = writer, │ │382 .patch_id = id.*, │ │383 .patch = fork_patch, │ │364 - .published = published, │ │384 + .posted = posted, │ │385 .target_oid = target_oid,│ │386 .target_ref = target_ref,│ │387 .title = title, │ ╰──────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────╮ │396 try writer.flush(); │ │397 │ │398 const revision_id = revision_id_maybe orelse return; │ │379 - if (!published) return; │ │399 + if (!posted) return; │ │400 var update_arena = std.heap.ArenaAllocator.init(allocator); │ │401 defer update_arena.deinit(); │ │402 const update_moment = evt.currentMoment(repo_opts, target_repo) catch return;│ ╰──────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯