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 {...@@ -861,7 +861,7 @@ pub const Repository = struct {
861 }861 }
862 const pack_index, const pack_offset = try r.getObjectPackIndex(oid) orelse return null;862 const pack_index, const pack_offset = try r.getObjectPackIndex(oid) orelse return null;
863 // parse .pack863 // 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);
865 }865 }
866866
867 fn getObjectPackIndex(r: *Repository, oid: Id) !?[2]usize {867 fn getObjectPackIndex(r: *Repository, oid: Id) !?[2]usize {
...@@ -923,8 +923,8 @@ pub const Repository = struct {...@@ -923,8 +923,8 @@ pub const Repository = struct {
923 return null;923 return null;
924 }924 }
925925
926 fn getPackedObject(r: *Repository, maybe_oid: ?Id, pack_index: usize, pack_offset: usize, cache_behavior: CacheBehavior) !GitObject {926 fn getPackedObject(r: *Repository, 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] });927 const t = tracer.trace(@src(), " {d} {d} {s}", .{ pack_index, pack_offset, r.pack_content.keys()[pack_index] });
928 defer t.end();928 defer t.end();
929929
930 const key = std.hash.Wyhash.hash(0, &(std.mem.toBytes(pack_index) ++ std.mem.toBytes(pack_offset)));930 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 {...@@ -978,15 +978,15 @@ pub const Repository = struct {
978 offset += 1;978 offset += 1;
979 }979 }
980 const base_pack_offset = pack_offset - offset;980 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);
982 defer if (cache_behavior == .no_cache) r.gpa.free(base_obj.content);982 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);
984 },984 },
985 .ref_delta => {985 .ref_delta => {
986 const base_oid = extras.to_hex(packedobj_fbs.takeSlice(20)[0..20].*);986 const base_oid = extras.to_hex(packedobj_fbs.takeSlice(20)[0..20].*);
987 const base_obj = (try r.getObject(&base_oid, cache_behavior)).?;987 const base_obj = (try r.getObject(&base_oid, cache_behavior)).?;
988 defer if (cache_behavior == .no_cache) r.gpa.free(base_obj.content);988 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);
990 },990 },
991 }991 }
992 comptime unreachable;992 comptime unreachable;
...@@ -998,7 +998,7 @@ pub const Repository = struct {...@@ -998,7 +998,7 @@ pub const Repository = struct {
998 }998 }
999 }999 }
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 {
1002 const compressed_content = packedobj_fbs.rest();1002 const compressed_content = packedobj_fbs.rest();
1003 var list: nio.AllocatingWriter = .init(r.gpa);1003 var list: nio.AllocatingWriter = .init(r.gpa);
1004 defer list.deinit();1004 defer list.deinit();
...@@ -1064,7 +1064,6 @@ pub const Repository = struct {...@@ -1064,7 +1064,6 @@ pub const Repository = struct {
1064 const _type = base_obj.type;1064 const _type = base_obj.type;
1065 const content = try list2.toOwnedSlice(r.gpa);1065 const content = try list2.toOwnedSlice(r.gpa);
1066 const obj: GitObject = .{ .type = _type, .content = content };1066 const obj: GitObject = .{ .type = _type, .content = content };
1067 _ = maybe_oid;
1068 if (cache_behavior == .cache) try r.unpacked_objects.put(r.gpa, key, obj);1067 if (cache_behavior == .cache) try r.unpacked_objects.put(r.gpa, key, obj);
1069 return obj;1068 return obj;
1070 }1069 }