╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ patch.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
1496 defer commit.deinit(); 1497 1498 // find patches whose selected revision matches this commit. 1499 const key = try std.fmt.bufPrint(&revision_key_buffer, "{s}\x00{s}", .{ update.ref_name[heads_prefix.len..], &commit.oid }); 1500 const ids_cursor = try revisions.getCursor(hash.hashInt(repo_opts.hash, key)) orelse continue; 1501 const ids = try DB.CountedHashSet(.read_only).init(ids_cursor); 1502 var ids_iter = try ids.iterator(); 1503 while (try ids_iter.next()) |cursor| { 1504 const pair = try cursor.readKeyValuePair(); 1505 var patch_id: [evt.event_id_size]u8 = undefined; 1506 if ((try pair.key_cursor.readBytes(&patch_id)).len != patch_id.len) return error.InvalidPatch; 1507 const patch_hex = std.fmt.bytesToHex(patch_id, .lower); 1508 1509 // a fast-forward has no recorded merge boundary; use the old ref tip 1510 const before_oid = if (std.mem.eql(u8, &commit.oid, &target.after_oid)) &old_oid else &target.before_oid; 1511 importMerged(repo_opts, state, db, moment, io, allocator, users_dir, &patch_id, &commit.oid, before_oid, &target.after_oid) catch |err| { 1512 serve_common.logError(io, error_writer, "failed to mark patch {s} as merged: {s}\n", .{ &patch_hex, @errorName(err) }); 1513 continue; 1514 }; 1515 } 1516 } 1517 } 1518 } 1519 } 1520