╭ changed ──╮ │src/try.zig│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │233 try repo_i.add(io, allocator, &.{ "README.md", "docs/dev/contribute.md" }); │ │234 _ = try repo_i.commit(io, allocator, .{ .message = "let there be light" }); │ │235 │ │236 - // a batch of empty commits so the commits tab has more than one page │ │237 - // to paginate through. stepped timestamps vary the date column. │ │236 + // a batch of commits so the commits tab has more than one page to │ │237 + // paginate through. each rewrites a few files with scattered line │ │238 + // edits, so every commit is a multi-file diff with several separate │ │239 + // hunks to look at. stepped timestamps vary the date column. │ │240 const base_ts: u64 = 1_700_000_000; // 2023-11-14 │ │241 + const edit_files = [_][]const u8{ "src/alpha.txt", "src/beta.txt", "src/gamma.txt" }; │ │242 var c: usize = 0; │ │243 while (c < 30) : (c += 1) { │ │241 - const message = try std.fmt.allocPrint(arena.allocator(), "empty commit {d}", .{c + 1}); │ │242 - _ = try repo_i.commit(io, allocator, .{ .message = message, .allow_empty = true, .timestamp = base_ts + c * std.time.s_per_day });│ │244 + { │ │245 + var repo_dir = try cwd.openDir(io, repo_path, .{}); │ │246 + defer repo_dir.close(io); │ │247 + try repo_dir.createDirPath(io, "src"); │ │248 + for (edit_files, 0..) |path, fi| { │ │249 + const file = try repo_dir.createFile(io, path, .{}); │ │250 + defer file.close(io); │ │251 + var writer = std.Io.Writer.Allocating.init(allocator); │ │252 + defer writer.deinit(); │ │253 + // every 8th line (offset per file) encodes the commit │ │254 + // number; the rest stay constant. the changed lines sit │ │255 + // far enough apart that diff renders each as its own hunk. │ │256 + for (0..40) |line| { │ │257 + if ((line + fi) % 8 == 0) { │ │258 + try writer.writer.print("line {d}: rev {d}\n", .{ line, c }); │ │259 + } else { │ │260 + try writer.writer.print("line {d}\n", .{line}); │ │261 + } │ │262 + } │ │263 + try file.writeStreamingAll(io, writer.written()); │ │264 + } │ │265 + } │ │266 + try repo_i.add(io, allocator, &edit_files); │ │267 + const message = try std.fmt.allocPrint(arena.allocator(), "scattered edits {d}", .{c + 1}); │ │268 + _ = try repo_i.commit(io, allocator, .{ .message = message, .timestamp = base_ts + c * std.time.s_per_day }); │ │269 } │ │270 } │ │271 │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯