From 8242af7c61028c1b840b5d680b963a395b5d1100 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sun, 28 Jun 2026 02:53:07 -0700 Subject: [PATCH] commits are rarely delta'd dont cache them in the window linux / debug: found 41 in 934ms after searching 26126 commits TypeScript /tests/baselines/reference/ debug: found 53049 in 19914ms after searching 14270 commits --- git.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/git.zig b/git.zig index 5c8e83b678a902f631dec45ed1d33e1f2abd7b0e..eab03ba5f884a51acbbcd4837c3bc1c7d513a555 100644 --- a/git.zig +++ b/git.zig @@ -1137,9 +1137,9 @@ pub const Repository = struct { if (cache_behavior == .cache) if (r.commits.get(id.id)) |val| { return .{ id, val }; }; - if (try r.getObject(id.id, .cache)) |obj| { + if (try r.getObject(id.id, .no_cache)) |obj| { if (obj.type == .commit) { - const raw = try r.gpa.dupe(u8, obj.content); + const raw = obj.content; errdefer r.gpa.free(raw); const commit = try r.gpa.create(Commit); errdefer r.gpa.destroy(commit); @@ -1147,6 +1147,7 @@ pub const Repository = struct { if (cache_behavior == .cache) try r.commits.put(r.gpa, id.id, commit); return .{ id, commit }; } + r.gpa.free(obj.content); } return null; } -- 2.54.0