╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ────────────╮ │src/search_thread.zig│ ╰─────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │52 query_text: []const u8, │ │53 filter: ?DB.SortedSet(.read_only), │ │54 ) !srch.Query(DB) { │ │87 - const cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, indexKey(kind))) orelse return .{ .terms = &.{} }; │ │55 + const cursor = try haxy_moment.getCursor(hash.hashInt(hash_kind, indexKey(kind))) orelse return .{ .terms = .empty };│ │56 const index = try DB.SortedMap(.read_only).init(cursor); │ │57 var results = try srch.Query(DB).init(index, aa, query_text); │ │58 if (filter) |set| try results.require(aa, set); │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │59 return results; │ │60 } │ │61 │ │94 -// the text a thread is indexed under: the title and tags first, so the │ │95 -// tokenizer's caps can only drop the tail of a long description. │ │96 -fn text(aa: std.mem.Allocator, value: Doc) ![]const u8 { │ │97 - return std.mem.concat(aa, u8, &.{ value.title, " ", value.tags, " ", value.description }); │ │62 +// the text a thread is indexed under, none once it is removed: the title and │ │63 +// tags first, so the tokenizer's caps can only drop the tail of a long │ │64 +// description. │ │65 +fn text(aa: std.mem.Allocator, record: anytype) ![]const u8 { │ │66 + if (record.removed) return ""; │ │67 + return std.mem.concat(aa, u8, &.{ record.event.title, " ", record.event.tags, " ", record.event.description });│ │68 } │ │69 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──╮ │src/try.zig│ ╰───────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │814 try evt.consume(.local, .repo, .xit, .{}, io, allocator, &template_repo, evt.events_ref, &discussion_comment_events); │ │815 try template_repo.patchAll(io, allocator, null); │ │816 try template_repo.addConfig(io, allocator, .{ .name = "core.bare", .value = "true" }); │ │817 - // fixtures commit directly, so index the ref tips by hand │ │818 - try find.refresh(.{}, io, allocator, &template_repo); │ │819 - try srch_cmmt.refresh(.{}, io, allocator, &template_repo); │ │817 + try transaction(io, &template_repo, Reindex{ .io = io, .allocator = allocator, .core = &template_repo.core, .commits = true });│ │818 // clear history only after indexing has written its transactions. │ │819 { │ │820 const moment = try evt.currentMoment(.{}, &template_repo); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1069 } │ │1070 try fork_repo.patchAll(io, allocator, null); │ │1071 try fork_repo.addConfig(io, allocator, .{ .name = "core.bare", .value = "true" }); │ │1074 - // the commits above skipped the push path, so index the patch branch by hand │ │1075 - try find.refresh(.{}, io, allocator, &fork_repo); │ │1072 + try transaction(io, &fork_repo, Reindex{ .io = io, .allocator = allocator, .core = &fork_repo.core, .commits = false });│ │1073 _ = try fork_repo.garbageCollect(io, allocator, .{}); │ │1074 try fork_dir.deleteFile(io, path); │ │1075 const revision_id = evt.EventWithId.randomId(random); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1457 │ │1458 // append `ctx` to the repo's history as one transaction. the fixtures write a │ │1459 // few states the normal paths have no way to produce │ │1460 +// fixtures commit directly, so the ref tips are indexed by hand. a fork gets │ │1461 +// no commit index, as in production. │ │1462 +const Reindex = struct { │ │1463 + io: std.Io, │ │1464 + allocator: std.mem.Allocator, │ │1465 + core: *rp.Repo(.xit, .{}).Core, │ │1466 + commits: bool, │ │1467 + │ │1468 + pub fn run(ctx: @This(), cursor: *rp.Repo(.xit, .{}).DB.Cursor(.read_write)) !void { │ │1469 + var moment = try rp.Repo(.xit, .{}).DB.HashMap(.read_write).init(cursor.*); │ │1470 + const state = rp.Repo(.xit, .{}).State(.read_write){ .core = ctx.core, .extra = .{ .moment = &moment } }; │ │1471 + _ = try find.refreshInTransaction(.{}, state, &moment, ctx.io, ctx.allocator, null); │ │1472 + if (ctx.commits) _ = try srch_cmmt.refreshInTransaction(.{}, state, &moment, ctx.io, ctx.allocator, &.{}, null);│ │1473 + } │ │1474 +}; │ │1475 + │ │1476 fn transaction(io: std.Io, repo: *rp.Repo(.xit, .{}), ctx: anytype) !void { │ │1477 const DB = rp.Repo(.xit, .{}).DB; │ │1478 try repo.core.db_file.lock(io, .exclusive); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────────╮ │src/ui/Repo/Commits.zig│ ╰───────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │172 next_start = try aa.dupe(u8, &oid); │ │173 break; │ │174 } │ │175 - // a result whose object is gone is skipped rather than shown │ │176 - var commit_object = obj.Object(.xit, repo_opts).init(state, io, gpa, &oid) catch continue; │ │175 + var commit_object = try obj.Object(.xit, repo_opts).initCommit(state, io, gpa, &oid); │ │176 defer commit_object.deinit(); │ │178 - if (commit_object.content != .commit) continue; │ │177 @memcpy(&oids[count], &oid); │ │178 buf[count] = try commitEntry(repo_kind, repo_opts, arena, repo, io, gpa, admin_moment, &commit_object, root_message and count == 0);│ │179 count += 1; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ───────────╮ │src/ui/Repo/Undo.zig│ ╰────────────────────╯ ╭─────────────────────────────────────────────────────────╮ │ 5 const pch = @import("../../patch.zig"); │ │ 6 const push = @import("../../push.zig"); │ │ 7 const fork = @import("../../fork.zig"); │ │ 8 -const find = @import("../../find.zig"); │ │ 9 -const srch_cmmt = @import("../../search_commit.zig");│ │ 8 const inp = @import("../input.zig"); │ │ 9 const xit = @import("xit"); │ │10 const rp = xit.repo; │ ╰─────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │138 if (std.mem.eql(u8, record.action_kind, pch.merge_undo_action)) return .{ .action = "merge patch", .description = "merged a patch into its target branch" }; │ │139 if (std.mem.eql(u8, record.action_kind, fork.undo_action)) return .{ .action = "fork", .description = "created a fork to draft a patch in" }; │ │140 if (std.mem.eql(u8, record.action_kind, pch.mergeability_undo_action)) return .{ .action = "mergeability", .description = "rechecked whether the open patches still merge cleanly" };│ │143 - if (std.mem.eql(u8, record.action_kind, find.undo_action)) return .{ .action = "file index", .description = "reindexed the files on a branch" }; │ │144 - if (std.mem.eql(u8, record.action_kind, srch_cmmt.undo_action)) return .{ .action = "commit index", .description = "reindexed the commits on a branch" }; │ │141 if (std.mem.eql(u8, record.action_kind, push.undo_action)) { │ │142 // a push consumes the events it carried in its own transaction │ │143 var buttons: std.ArrayList(DetailButton) = .empty; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯