| ... | ... | @@ -861,7 +861,7 @@ pub const Repository = struct { |
| 861 | 861 | } |
| 862 | 862 | const pack_index, const pack_offset = try r.getObjectPackIndex(oid) orelse return null; |
| 863 | 863 | // 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 | } |
| 866 | 866 | |
| 867 | 867 | fn getObjectPackIndex(r: *Repository, oid: Id) !?[2]usize { |
| ... | ... | @@ -923,8 +923,8 @@ pub const Repository = struct { |
| 923 | 923 | return null; |
| 924 | 924 | } |
| 925 | 925 | |
| 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] }); |
| 928 | 928 | defer t.end(); |
| 929 | 929 | |
| 930 | 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 | 978 | offset += 1; |
| 979 | 979 | } |
| 980 | 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 | 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 | 985 | .ref_delta => { |
| 986 | 986 | const base_oid = extras.to_hex(packedobj_fbs.takeSlice(20)[0..20].*); |
| 987 | 987 | const base_obj = (try r.getObject(&base_oid, cache_behavior)).?; |
| 988 | 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 | 992 | comptime unreachable; |
| ... | ... | @@ -998,7 +998,7 @@ pub const Repository = struct { |
| 998 | 998 | } |
| 999 | 999 | } |
| 1000 | 1000 | |
| 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 | 1002 | const compressed_content = packedobj_fbs.rest(); |
| 1003 | 1003 | var list: nio.AllocatingWriter = .init(r.gpa); |
| 1004 | 1004 | defer list.deinit(); |
| ... | ... | @@ -1064,7 +1064,6 @@ pub const Repository = struct { |
| 1064 | 1064 | const _type = base_obj.type; |
| 1065 | 1065 | const content = try list2.toOwnedSlice(r.gpa); |
| 1066 | 1066 | const obj: GitObject = .{ .type = _type, .content = content }; |
| 1067 | | _ = maybe_oid; |
| 1068 | 1067 | if (cache_behavior == .cache) try r.unpacked_objects.put(r.gpa, key, obj); |
| 1069 | 1068 | return obj; |
| 1070 | 1069 | } |