╭ search_commit.zig ────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1 const std = @import("std"); 2 const evt = @import("event.zig"); 3 const srch = @import("search.zig"); 4 const xit = @import("xit"); 5 const rp = xit.repo; 6 const hash = xit.hash; 7 const rf = xit.ref; 8 const obj = xit.object; 9 const mrg = xit.merge; 10 const serve_common = @import("serve_common.zig"); 11 12 // the repo moment key holding one commit-message index per ref tip. it sits 13 // outside the haxy moment because pushes change it and events never do. each 14 // entry is keyed by its commit oid's hash: its value is the index as of that 15 // commit, and its key slot holds the raw commit oid. 16 pub const index_key = "haxy/commit-oid->word->time+oid"; 17 18 // a commit a version covers. 19 pub fn Commit(comptime hash_kind: hash.HashKind) type { 20 return struct { 21 oid: [hash.hexLen(hash_kind)]u8, 22 timestamp: u64, 23 }; 24 } 25 26 // `commit_oid`'s index, or null when it has none. a version is correct for its 27 // commit by construction, so there is nothing to check for staleness. 28 pub fn lookup( 29 comptime repo_opts: rp.RepoOpts(.xit), 30 moment: rp.Repo(.xit, repo_opts).DB.HashMap(.read_only), 31 commit_oid: *const [hash.hexLen(repo_opts.hash)]u8, 32 ) !?rp.Repo(.xit, repo_opts).DB.SortedMap(.read_only) { 33 const DB = rp.Repo(.xit, repo_opts).DB; 34 const index_cursor = try moment.getCursor(hash.hashInt(repo_opts.hash, index_key)) orelse return null; 35 const index = try DB.HashMap(.read_only).init(index_cursor); 36 const cursor = try index.getCursor(try hash.hexToInt(repo_opts.hash, commit_oid)) orelse return null; 37 return try DB.SortedMap(.read_only).init(cursor); 38 } 39 40 // a commit's doc key: its committer timestamp counting down, so a posting set 41 // iterates newest first and a new commit inserts at the front, then its raw 42 // oid, which makes the key unique. 43 pub fn docKey( 44 comptime hash_kind: hash.HashKind, 45 timestamp: u64, 46 oid: *const [hash.hexLen(hash_kind)]u8, 47 ) ![docKeyLen(hash_kind)]u8 { 48 var key: [docKeyLen(hash_kind)]u8 = undefined; 49 std.mem.writeInt(u64, key[0..@sizeOf(u64)], std.math.maxInt(u64) - timestamp, .big); 50 _ = try std.fmt.hexToBytes(key[@sizeOf(u64)..], oid); 51 return key; 52 } 53 54 // the commit a doc key names. 55 pub fn keyOid(comptime hash_kind: hash.HashKind, key: []const u8) ![hash.hexLen(hash_kind)]u8 { 56 if (key.len != docKeyLen(hash_kind)) return error.InvalidCommitIndex; 57 var oid: [hash.byteLen(hash_kind)]u8 = undefined; 58 @memcpy(&oid, key[@sizeOf(u64)..]); 59 return std.fmt.bytesToHex(oid, .lower); 60 } 61 62 fn docKeyLen(comptime hash_kind: hash.HashKind) usize { 63 return @sizeOf(u64) + hash.byteLen(hash_kind); 64 } 65 66 // the action a commit index refresh records when it runs on its own 67 pub const undo_action = "haxy/commit-index"; 68 69 // reconcile the index versions with the repo's ref tips, in a transaction of 70 // its own 71 pub fn refresh( 72 comptime repo_opts: rp.RepoOpts(.xit), 73 io: std.Io, 74 allocator: std.mem.Allocator, 75 repo: *rp.Repo(.xit, repo_opts), 76 updates: ?[]const xit.net_server_receive_pack.AppliedRefUpdate, 77 ) !void { 78 const Repo = rp.Repo(.xit, repo_opts); 79 const DB = Repo.DB; 80 const Save = struct { 81 core: *Repo.Core, 82 io: std.Io, 83 allocator: std.mem.Allocator, 84 updates: ?[]const xit.net_server_receive_pack.AppliedRefUpdate, 85 86 pub fn run(ctx: @This(), cursor: *DB.Cursor(.read_write)) !void { 87 var moment = try DB.HashMap(.read_write).init(cursor.*); 88 const state = Repo.State(.read_write){ .core = ctx.core, .extra = .{ .moment = &moment } }; 89 if (!try refreshInTransaction(repo_opts, state, &moment, ctx.io, ctx.allocator, ctx.updates, null)) return error.CancelTransaction; 90 91 // record the user action for undo 92 try xit.undo.write(repo_opts, state, std.Io.Timestamp.now(ctx.io, .real).toSeconds(), .{ .custom = .{ .action_kind = undo_action } }); 93 } 94 }; 95 96 // held across the reads and the writes, so a concurrent refresh can't 97 // change the entries these decisions were made from. 98 try repo.core.db_file.lock(io, .exclusive); 99 defer repo.core.db_file.unlock(io); 100 101 const history = try DB.ArrayList(.read_write).init(repo.core.db.rootCursor()); 102 history.appendContext(.{ .slot = try history.getSlot(-1) }, Save{ .core = &repo.core, .io = io, .allocator = allocator, .updates = updates }) catch |err| switch (err) { 103 error.CancelTransaction => {}, 104 else => return err, 105 }; 106 } 107 108 // reconcile them inside the caller's transaction, so the index lands with the 109 // push that invalidated it. `updates` is that push, whose old oids are the 110 // cheapest bases to derive the new tips from. reports whether anything was 111 // written, so a caller that owns an otherwise empty transaction can cancel it 112 pub fn refreshInTransaction( 113 comptime repo_opts: rp.RepoOpts(.xit), 114 state: rp.Repo(.xit, repo_opts).State(.read_write), 115 moment: *rp.Repo(.xit, repo_opts).DB.HashMap(.read_write), 116 io: std.Io, 117 allocator: std.mem.Allocator, 118 updates: ?[]const xit.net_server_receive_pack.AppliedRefUpdate, 119 progress_ctx_maybe: ?repo_opts.ProgressCtx, 120 ) !bool { 121 const Repo = rp.Repo(.xit, repo_opts); 122 const DB = Repo.DB; 123 const Oid = [hash.hexLen(repo_opts.hash)]u8; 124 const Tip = Commit(repo_opts.hash); 125 126 // one version to build: the commit it covers, and the commit whose version 127 // it derives from (null = walk the whole history). 128 const Work = struct { 129 oid: Oid, 130 timestamp: u64, 131 base: ?Oid, 132 }; 133 134 var arena = std.heap.ArenaAllocator.init(allocator); 135 defer arena.deinit(); 136 const aa = arena.allocator(); 137 138 var work: std.ArrayList(Work) = .empty; 139 var gone: std.ArrayList(Oid) = .empty; 140 var default_tip: ?Oid = null; 141 // the versions a new tip can derive from 142 var versions: std.ArrayList(Tip) = .empty; 143 144 { 145 const read_state = state.readOnly(); 146 147 // the commits that already have a version 148 var existing: std.AutoArrayHashMapUnmanaged(Oid, void) = .empty; 149 if (try moment.getCursor(hash.hashInt(repo_opts.hash, index_key))) |index_cursor| { 150 const index = try DB.HashMap(.read_only).init(index_cursor); 151 var iter = try index.iterator(); 152 while (try iter.next()) |cursor| { 153 const pair = try cursor.readKeyValuePair(); 154 var oid_bytes: [hash.byteLen(repo_opts.hash)]u8 = undefined; 155 if ((try pair.key_cursor.readBytes(&oid_bytes)).len != oid_bytes.len) return error.InvalidCommitIndex; 156 try existing.put(aa, std.fmt.bytesToHex(oid_bytes, .lower), {}); 157 } 158 } 159 160 // what every head except the events branch and every tag points at 161 var tips: std.ArrayList(Oid) = .empty; 162 { 163 var branches = try rf.RefIterator(.xit, repo_opts).init(read_state, io, allocator, .head, .beginning); 164 defer branches.deinit(); 165 while (try branches.next()) |ref| { 166 if (std.mem.eql(u8, ref.name, evt.events_ref.name)) continue; 167 try tips.append(aa, (try rf.readRecur(.xit, repo_opts, read_state, io, .{ .ref = .{ .kind = .head, .name = ref.name } })) orelse continue); 168 } 169 } 170 { 171 var tags = try rf.RefIterator(.xit, repo_opts).init(read_state, io, allocator, .tag, .beginning); 172 defer tags.deinit(); 173 while (try tags.next()) |ref| { 174 try tips.append(aa, (try rf.readRecur(.xit, repo_opts, read_state, io, .{ .ref = .{ .kind = .tag, .name = ref.name } })) orelse continue); 175 } 176 } 177 178 // the commits a version is wanted for, annotated tags peeled. refs 179 // sharing a commit share its version. 180 var wanted: std.AutoArrayHashMapUnmanaged(Oid, void) = .empty; 181 var missing: std.AutoArrayHashMapUnmanaged(Oid, Work) = .empty; 182 for (tips.items) |tip| { 183 // a tip that already has a version needs no reading 184 if (existing.contains(tip)) { 185 try wanted.put(aa, tip, {}); 186 continue; 187 } 188 var commit = obj.Object(.xit, repo_opts).initCommit(read_state, io, allocator, &tip) catch continue; 189 defer commit.deinit(); 190 try wanted.put(aa, commit.oid, {}); 191 if (existing.contains(commit.oid)) continue; 192 const entry = try missing.getOrPut(aa, commit.oid); 193 if (!entry.found_existing) entry.value_ptr.* = .{ 194 .oid = commit.oid, 195 .timestamp = commit.content.commit.metadata.timestamp, 196 .base = null, 197 }; 198 if (entry.value_ptr.base == null) entry.value_ptr.base = pushedFrom(repo_opts, updates, &tip, existing); 199 } 200 201 var head_buffer: [rf.MAX_REF_CONTENT_SIZE]u8 = undefined; 202 if (rf.readHead(.xit, repo_opts, read_state, io, &head_buffer) catch null) |head| switch (head) { 203 .ref => |ref| default_tip = try rf.readRecur(.xit, repo_opts, read_state, io, .{ .ref = .{ .kind = .head, .name = ref.name } }), 204 .oid => {}, 205 }; 206 207 // an entry whose commit is gone can't be walked from, so it isn't a 208 // candidate. 209 const unbased = for (missing.values()) |item| { 210 if (item.base == null) break true; 211 } else false; 212 if (unbased) for (existing.keys()) |oid| { 213 var commit = obj.Object(.xit, repo_opts).initCommit(read_state, io, allocator, &oid) catch continue; 214 defer commit.deinit(); 215 try versions.append(aa, .{ .oid = oid, .timestamp = commit.content.commit.metadata.timestamp }); 216 }; 217 218 try work.appendSlice(aa, missing.values()); 219 // oldest first, so a later tip derives from an earlier one 220 std.mem.sort(Work, work.items, {}, struct { 221 fn lessThan(_: void, a: Work, b: Work) bool { 222 return a.timestamp < b.timestamp; 223 } 224 }.lessThan); 225 226 for (existing.keys()) |oid| { 227 if (!wanted.contains(oid)) try gone.append(aa, oid); 228 } 229 } 230 231 if (work.items.len == 0 and gone.items.len == 0) return false; 232 233 { 234 const index_hash = hash.hashInt(repo_opts.hash, index_key); 235 236 var message: std.ArrayList(u8) = .empty; 237 defer message.deinit(allocator); 238 239 for (work.items) |item| { 240 const index = try DB.HashMap(.read_write).init(try moment.putCursor(index_hash)); 241 const base = item.base orelse nearestVersion(repo_opts.hash, versions.items, default_tip, item.timestamp); 242 243 var oid_bytes: [hash.byteLen(repo_opts.hash)]u8 = undefined; 244 _ = try std.fmt.hexToBytes(&oid_bytes, &item.oid); 245 const oid_int = hash.bytesToInt(repo_opts.hash, &oid_bytes); 246 try index.putKey(oid_int, .{ .bytes = &oid_bytes }); 247 var version_cursor = try index.putCursor(oid_int); 248 if (base) |base_oid| { 249 const base_cursor = (try index.getCursor(try hash.hexToInt(repo_opts.hash, &base_oid))) orelse return error.InvalidCommitIndex; 250 try version_cursor.write(.{ .slot = base_cursor.slot() }); 251 } 252 const version = try DB.SortedMap(.read_write).init(version_cursor); 253 254 var diff_arena = std.heap.ArenaAllocator.init(allocator); 255 defer diff_arena.deinit(); 256 const diff = try commitDiff(repo_opts, state.readOnly(), io, allocator, diff_arena.allocator(), if (base) |*base_oid| base_oid else null, &item.oid, progress_ctx_maybe); 257 258 // the walk is done, so the messages left to read are the total 259 serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .text = "Indexing commits" }); 260 serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .start = .{ .kind = .writing_patch, .estimated_total_items = diff.removed.len + diff.added.len } }); 261 for (diff.removed) |commit| { 262 defer serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .complete_one = .writing_patch }); 263 const key = try readPosting(repo_opts, state.readOnly(), io, allocator, &message, commit); 264 try srch.remove(DB, version, allocator, &key, message.items); 265 } 266 for (diff.added) |commit| { 267 defer serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .complete_one = .writing_patch }); 268 const key = try readPosting(repo_opts, state.readOnly(), io, allocator, &message, commit); 269 try srch.add(DB, version, allocator, &key, message.items); 270 } 271 serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .end = .writing_patch }); 272 273 try versions.append(aa, .{ .oid = item.oid, .timestamp = item.timestamp }); 274 // the next version copies this one's slot, so everything 275 // written so far has to be shared rather than mutated 276 try state.core.db.freeze(); 277 } 278 279 // removing last keeps a tip that is going away available as a base 280 const index = try DB.HashMap(.read_write).init(try moment.putCursor(index_hash)); 281 for (gone.items) |oid| _ = try index.remove(try hash.hexToInt(repo_opts.hash, &oid)); 282 } 283 return true; 284 } 285 286 // the version a tip committed at `timestamp` derives from when no push names 287 // one: the default branch's unless it is newer than the tip, else the nearest 288 // older one, else the oldest. a guess by dates that only the cost rides on. 289 fn nearestVersion( 290 comptime hash_kind: hash.HashKind, 291 versions: []const Commit(hash_kind), 292 default_tip: ?[hash.hexLen(hash_kind)]u8, 293 timestamp: u64, 294 ) ?[hash.hexLen(hash_kind)]u8 { 295 var older: ?Commit(hash_kind) = null; 296 var oldest: ?Commit(hash_kind) = null; 297 for (versions) |version| { 298 if (version.timestamp <= timestamp) { 299 if (default_tip) |oid| if (std.mem.eql(u8, &oid, &version.oid)) return oid; 300 const nearer = if (older) |found| version.timestamp > found.timestamp else true; 301 if (nearer) older = version; 302 } 303 const earlier = if (oldest) |found| version.timestamp < found.timestamp else true; 304 if (earlier) oldest = version; 305 } 306 return if (older orelse oldest) |version| version.oid else null; 307 } 308 309 // the commit this push moved a ref to `tip` from, when it has a version to 310 // derive from. 311 fn pushedFrom( 312 comptime repo_opts: rp.RepoOpts(.xit), 313 updates: ?[]const xit.net_server_receive_pack.AppliedRefUpdate, 314 tip: *const [hash.hexLen(repo_opts.hash)]u8, 315 existing: std.AutoArrayHashMapUnmanaged([hash.hexLen(repo_opts.hash)]u8, void), 316 ) ?[hash.hexLen(repo_opts.hash)]u8 { 317 for (updates orelse &.{}) |update| { 318 if (!std.mem.eql(u8, update.new_oid, tip)) continue; 319 if (update.old_oid.len != hash.hexLen(repo_opts.hash)) continue; 320 var oid: [hash.hexLen(repo_opts.hash)]u8 = undefined; 321 @memcpy(&oid, update.old_oid); 322 if (existing.contains(oid)) return oid; 323 } 324 return null; 325 } 326 327 // read `commit`'s message into `message` and return the doc key it indexes 328 // under. 329 fn readPosting( 330 comptime repo_opts: rp.RepoOpts(.xit), 331 state: rp.Repo(.xit, repo_opts).State(.read_only), 332 io: std.Io, 333 allocator: std.mem.Allocator, 334 message: *std.ArrayList(u8), 335 commit: Commit(repo_opts.hash), 336 ) ![docKeyLen(repo_opts.hash)]u8 { 337 message.clearRetainingCapacity(); 338 var object = try obj.Object(.xit, repo_opts).init(state, io, allocator, &commit.oid); 339 defer object.deinit(); 340 object.readMessage(allocator, message, .limited(srch.max_indexed_bytes)) catch |err| switch (err) { 341 // only the indexed prefix matters 342 error.StreamTooLong => {}, 343 else => |e| return e, 344 }; 345 return docKey(repo_opts.hash, commit.timestamp, &commit.oid); 346 } 347 348 // what `tip` reaches that `base_tip` doesn't, and the other way round, built 349 // into `aa`. with no base the whole history is added. 350 fn commitDiff( 351 comptime repo_opts: rp.RepoOpts(.xit), 352 state: rp.Repo(.xit, repo_opts).State(.read_only), 353 io: std.Io, 354 allocator: std.mem.Allocator, 355 aa: std.mem.Allocator, 356 base_tip: ?*const [hash.hexLen(repo_opts.hash)]u8, 357 tip: *const [hash.hexLen(repo_opts.hash)]u8, 358 progress_ctx_maybe: ?repo_opts.ProgressCtx, 359 ) !struct { removed: []const Commit(repo_opts.hash), added: []const Commit(repo_opts.hash) } { 360 var removed: std.ArrayList(Commit(repo_opts.hash)) = .empty; 361 var added: std.ArrayList(Commit(repo_opts.hash)) = .empty; 362 363 if (base_tip) |base| { 364 const Ancestry = mrg.Ancestry(.xit, repo_opts); 365 var ancestry = try Ancestry.init(state, io, allocator, base, tip); 366 defer ancestry.deinit(); 367 try ancestry.finish(); 368 369 // timestamps only choose the walk's order, so a commit the base reached 370 // can be passed before the tip turns out to reach it too. that can only 371 // make a removal wrong, never an addition. a fast-forward removes 372 // nothing, which the base tip picking up the tip's flag proves. anything 373 // else is settled by walking until nothing is left to carry down. 374 const base_node = ancestry.nodes.get(ancestry.tips[0]) orelse unreachable; 375 const fast_forward = base_node.flags & Ancestry.two != 0; 376 if (!fast_forward) { 377 var candidates = false; 378 var flagged = ancestry.nodes.valueIterator(); 379 while (flagged.next()) |node| { 380 if (node.flags & Ancestry.both == Ancestry.one) candidates = true; 381 } 382 if (candidates) while (try ancestry.step()) {}; 383 } 384 385 var iter = ancestry.nodes.iterator(); 386 while (iter.next()) |entry| { 387 // tag objects are peeled through, not walked 388 if (entry.value_ptr.tag_target != null) continue; 389 const commit = Commit(repo_opts.hash){ .oid = entry.key_ptr.*, .timestamp = entry.value_ptr.timestamp }; 390 switch (entry.value_ptr.flags & Ancestry.both) { 391 Ancestry.one => if (!fast_forward) try removed.append(aa, commit), 392 Ancestry.two => try added.append(aa, commit), 393 else => {}, 394 } 395 } 396 } else { 397 // a whole history has no count until it is walked, so the walk reports 398 // the commits it has reached so far 399 serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .text = "Walking commits" }); 400 serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .start = .{ .kind = .writing_patch, .estimated_total_items = 0 } }); 401 var iter = try obj.ObjectIterator(.xit, repo_opts).init(state, io, allocator, .{ .kind = .commit }); 402 defer iter.deinit(); 403 try iter.include(tip); 404 while (try iter.next(allocator)) |object| { 405 defer object.deinit(); 406 try added.append(aa, .{ .oid = object.oid, .timestamp = object.content.commit.metadata.timestamp }); 407 serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .complete_one = .writing_patch }); 408 } 409 serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .end = .writing_patch }); 410 } 411 412 return .{ .removed = removed.items, .added = added.items }; 413 } 414