authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-27 19:53:00 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-27 19:53:00 -07:00
log00f78a59fc822ae595132f3a01dee19a30d8d23d
tree6eb8d429bf50c35eccb38a2b65204161a450e4a5
parent0cceba07a0e5fa26ec33e1a00b2e3b0aab07dbdd
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

remove unused maybe_oid param from getPackedObject

since d398facfc305601c6628d986fe9306a046066b7a

1 files changed, 7 insertions(+), 8 deletions(-)

git.zig+7-8
......@@ -861,7 +861,7 @@ pub const Repository = struct {
861861 }
862862 const pack_index, const pack_offset = try r.getObjectPackIndex(oid) orelse return null;
863863 // parse .pack
864 return try r.getPackedObject(oid, pack_index, pack_offset, cache_behavior);
864 return try r.getPackedObject(pack_index, pack_offset, cache_behavior);
865865 }
866866
867867 fn getObjectPackIndex(r: *Repository, oid: Id) !?[2]usize {
......@@ -923,8 +923,8 @@ pub const Repository = struct {
923923 return null;
924924 }
925925
926 fn getPackedObject(r: *Repository, maybe_oid: ?Id, pack_index: usize, pack_offset: usize, cache_behavior: CacheBehavior) !GitObject {
927 const t = tracer.trace(@src(), " {?s} {d} {d} {s}", .{ maybe_oid, pack_index, pack_offset, r.pack_content.keys()[pack_index] });
926 fn getPackedObject(r: *Repository, pack_index: usize, pack_offset: usize, cache_behavior: CacheBehavior) !GitObject {
927 const t = tracer.trace(@src(), " {d} {d} {s}", .{ pack_index, pack_offset, r.pack_content.keys()[pack_index] });
928928 defer t.end();
929929
930930 const key = std.hash.Wyhash.hash(0, &(std.mem.toBytes(pack_index) ++ std.mem.toBytes(pack_offset)));
......@@ -978,15 +978,15 @@ pub const Repository = struct {
978978 offset += 1;
979979 }
980980 const base_pack_offset = pack_offset - offset;
981 const base_obj = try r.getPackedObject(null, pack_index, base_pack_offset, cache_behavior);
981 const base_obj = try r.getPackedObject(pack_index, base_pack_offset, cache_behavior);
982982 defer if (cache_behavior == .no_cache) r.gpa.free(base_obj.content);
983 return r.getDeltadObject(maybe_oid, key, &packedobj_fbs, size, base_obj, cache_behavior);
983 return r.getDeltadObject(key, &packedobj_fbs, size, base_obj, cache_behavior);
984984 },
985985 .ref_delta => {
986986 const base_oid = extras.to_hex(packedobj_fbs.takeSlice(20)[0..20].*);
987987 const base_obj = (try r.getObject(&base_oid, cache_behavior)).?;
988988 defer if (cache_behavior == .no_cache) r.gpa.free(base_obj.content);
989 return r.getDeltadObject(maybe_oid, key, &packedobj_fbs, size, base_obj, cache_behavior);
989 return r.getDeltadObject(key, &packedobj_fbs, size, base_obj, cache_behavior);
990990 },
991991 }
992992 comptime unreachable;
......@@ -998,7 +998,7 @@ pub const Repository = struct {
998998 }
999999 }
10001000
1001 fn getDeltadObject(r: *Repository, maybe_oid: ?Id, key: u64, packedobj_fbs: *nio.FixedBufferStream([]const u8), size: usize, base_obj: GitObject, cache_behavior: CacheBehavior) !GitObject {
1001 fn getDeltadObject(r: *Repository, key: u64, packedobj_fbs: *nio.FixedBufferStream([]const u8), size: usize, base_obj: GitObject, cache_behavior: CacheBehavior) !GitObject {
10021002 const compressed_content = packedobj_fbs.rest();
10031003 var list: nio.AllocatingWriter = .init(r.gpa);
10041004 defer list.deinit();
......@@ -1064,7 +1064,6 @@ pub const Repository = struct {
10641064 const _type = base_obj.type;
10651065 const content = try list2.toOwnedSlice(r.gpa);
10661066 const obj: GitObject = .{ .type = _type, .content = content };
1067 _ = maybe_oid;
10681067 if (cache_behavior == .cache) try r.unpacked_objects.put(r.gpa, key, obj);
10691068 return obj;
10701069 }