╭ changed ────────────╮ │src/search_commit.zig│ ╰─────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────╮ │ 8 const obj = xit.object; │ │ 9 const mrg = xit.merge; │ │10 const serve_common = @import("serve_common.zig"); │ │11 +const progress = @import("./progress.zig"); │ │12 │ │13 // the repo moment key holding one commit-message index per ref tip. it sits │ │14 // outside the haxy moment because pushes change it and events never do. each│ ╰─────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │257 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);│ │258 │ │259 // 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 } }); │ │260 + progress.report(repo_opts, io, progress_ctx_maybe, .{ .text = "Indexing commits" }); │ │261 + progress.report(repo_opts, io, progress_ctx_maybe, .{ .start = .{ .kind = .writing_patch, .estimated_total_items = diff.removed.len + diff.added.len } }); │ │262 for (diff.removed) |commit| { │ │262 - if (serve_common.progressCancelled(repo_opts, progress_ctx_maybe)) return error.ClientGone; │ │263 - defer serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .complete_one = .writing_patch }); │ │263 + if (progress.cancelled(repo_opts, progress_ctx_maybe)) return error.ClientGone; │ │264 + defer progress.report(repo_opts, io, progress_ctx_maybe, .{ .complete_one = .writing_patch }); │ │265 const key = try readPosting(repo_opts, state.readOnly(), io, allocator, &message, commit); │ │266 try srch.remove(DB, version, allocator, &key, message.items); │ │267 } │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │268 for (diff.added) |commit| { │ │268 - if (serve_common.progressCancelled(repo_opts, progress_ctx_maybe)) return error.ClientGone; │ │269 - defer serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .complete_one = .writing_patch });│ │269 + if (progress.cancelled(repo_opts, progress_ctx_maybe)) return error.ClientGone; │ │270 + defer progress.report(repo_opts, io, progress_ctx_maybe, .{ .complete_one = .writing_patch }); │ │271 const key = try readPosting(repo_opts, state.readOnly(), io, allocator, &message, commit); │ │272 try srch.add(DB, version, allocator, &key, message.items); │ │273 } │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │273 - serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .end = .writing_patch });│ │274 + progress.report(repo_opts, io, progress_ctx_maybe, .{ .end = .writing_patch }); │ │275 │ │276 try versions.append(aa, .{ .oid = item.oid, .timestamp = item.timestamp }); │ │277 // the next version copies this one's slot, so everything │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │399 } else { │ │400 // a whole history has no count until it is walked, so the walk reports │ │401 // the commits it has reached so far │ │401 - serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .text = "Walking commits" }); │ │402 - serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .start = .{ .kind = .writing_patch, .estimated_total_items = 0 } });│ │402 + progress.report(repo_opts, io, progress_ctx_maybe, .{ .text = "Walking commits" }); │ │403 + progress.report(repo_opts, io, progress_ctx_maybe, .{ .start = .{ .kind = .writing_patch, .estimated_total_items = 0 } }); │ │404 var iter = try obj.ObjectIterator(.xit, repo_opts).init(state, io, allocator, .{ .kind = .commit }); │ │405 defer iter.deinit(); │ │406 try iter.include(tip); │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │407 while (try iter.next(allocator)) |object| { │ │408 defer object.deinit(); │ │409 try added.append(aa, .{ .oid = object.oid, .timestamp = object.content.commit.metadata.timestamp });│ │409 - serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .complete_one = .writing_patch });│ │410 + progress.report(repo_opts, io, progress_ctx_maybe, .{ .complete_one = .writing_patch }); │ │411 } │ │411 - serve_common.reportProgress(repo_opts, io, progress_ctx_maybe, .{ .end = .writing_patch }); │ │412 + progress.report(repo_opts, io, progress_ctx_maybe, .{ .end = .writing_patch }); │ │413 } │ │414 │ │415 return .{ .removed = removed.items, .added = added.items }; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯