| ... | @@ -992,7 +992,7 @@ pub const Repository = struct { | ... | @@ -992,7 +992,7 @@ pub const Repository = struct { |
| 992 | while (try iter.next()) |entry| { | 992 | while (try iter.next()) |entry| { |
| 993 | if (entry.type != .REG) continue; | 993 | if (entry.type != .REG) continue; |
| 994 | if (!std.mem.endsWith(u8, entry.name, ".idx")) continue; | 994 | if (!std.mem.endsWith(u8, entry.name, ".idx")) continue; |
| 995 | std.log.debug("packdir iterate: {s}", .{entry.name}); | 995 | // std.log.debug("packdir iterate: {s}", .{entry.name}); |
| 996 | | 996 | |
| 997 | const idx_file = try packdir.openFile(entry.name, .{}); | 997 | const idx_file = try packdir.openFile(entry.name, .{}); |
| 998 | defer idx_file.close(); | 998 | defer idx_file.close(); |
| ... | @@ -1017,7 +1017,7 @@ pub const Repository = struct { | ... | @@ -1017,7 +1017,7 @@ pub const Repository = struct { |
| 1017 | const object_id = &extras.to_hex(name_bytes[i * 20 ..][0..20].*); | 1017 | const object_id = &extras.to_hex(name_bytes[i * 20 ..][0..20].*); |
| 1018 | const pack_offset = std.mem.readInt(u32, offset_bytes[i * 4 ..][0..4], .big); | 1018 | const pack_offset = std.mem.readInt(u32, offset_bytes[i * 4 ..][0..4], .big); |
| 1019 | if (std.mem.eql(u8, object_id, oid)) { | 1019 | if (std.mem.eql(u8, object_id, oid)) { |
| 1020 | std.log.debug("found {s} in {s} at offset {d}", .{ oid, idx_path, pack_offset }); | 1020 | // std.log.debug("found {s} in {s} at offset {d}", .{ oid, idx_path, pack_offset }); |
| 1021 | const pack_index = r.pack_content.getIndex(idx_path) orelse clk: { | 1021 | const pack_index = r.pack_content.getIndex(idx_path) orelse clk: { |
| 1022 | var pack_path: [128]u8 = @splat(0); | 1022 | var pack_path: [128]u8 = @splat(0); |
| 1023 | @memcpy(pack_path[0..13], "objects/pack/"); | 1023 | @memcpy(pack_path[0..13], "objects/pack/"); |
| ... | @@ -1040,7 +1040,7 @@ pub const Repository = struct { | ... | @@ -1040,7 +1040,7 @@ pub const Repository = struct { |
| 1040 | } else return null; | 1040 | } else return null; |
| 1041 | | 1041 | |
| 1042 | // parse .pack | 1042 | // parse .pack |
| 1043 | std.log.debug("pack_index={d} pack_offset={d}", .{ pack_index, pack_offset }); | 1043 | // std.log.debug("pack_index={d} pack_offset={d}", .{ pack_index, pack_offset }); |
| 1044 | | 1044 | |
| 1045 | return try r.getPackedObject(oid, pack_index, pack_offset); | 1045 | return try r.getPackedObject(oid, pack_index, pack_offset); |
| 1046 | } | 1046 | } |
| ... | @@ -1087,7 +1087,7 @@ pub const Repository = struct { | ... | @@ -1087,7 +1087,7 @@ pub const Repository = struct { |
| 1087 | return obj; | 1087 | return obj; |
| 1088 | }, | 1088 | }, |
| 1089 | .ofs_delta => { | 1089 | .ofs_delta => { |
| 1090 | std.log.debug("type={s} size={d}", .{ @tagName(ty), size }); | 1090 | // std.log.debug("type={s} size={d}", .{ @tagName(ty), size }); |
| 1091 | var offset: usize = 0; | 1091 | var offset: usize = 0; |
| 1092 | while (true) { | 1092 | while (true) { |
| 1093 | const c2: usize = packedobj_fbs.takeByte(); | 1093 | const c2: usize = packedobj_fbs.takeByte(); |
| ... | @@ -1097,7 +1097,7 @@ pub const Repository = struct { | ... | @@ -1097,7 +1097,7 @@ pub const Repository = struct { |
| 1097 | } | 1097 | } |
| 1098 | const base_pack_offset = pack_offset - offset; | 1098 | const base_pack_offset = pack_offset - offset; |
| 1099 | const base_obj = try r.getPackedObject(null, pack_index, base_pack_offset); | 1099 | const base_obj = try r.getPackedObject(null, pack_index, base_pack_offset); |
| 1100 | std.log.debug("base: type={s} content=[{d}]", .{ @tagName(base_obj.type), base_obj.content.len }); | 1100 | // std.log.debug("base: type={s} content=[{d}]", .{ @tagName(base_obj.type), base_obj.content.len }); |
| 1101 | | 1101 | |
| 1102 | const compressed_content = packedobj_fbs.rest()[0..size]; | 1102 | const compressed_content = packedobj_fbs.rest()[0..size]; |
| 1103 | var bufr = nio.FixedBufferStream([]const u8).init(compressed_content); | 1103 | var bufr = nio.FixedBufferStream([]const u8).init(compressed_content); |
| ... | @@ -1107,7 +1107,7 @@ pub const Repository = struct { | ... | @@ -1107,7 +1107,7 @@ pub const Repository = struct { |
| 1107 | try list.ensureUnusedCapacity(r.gpa, size); | 1107 | try list.ensureUnusedCapacity(r.gpa, size); |
| 1108 | try std.compress.flate.inflate.decompress(.zlib, bufr.anyReadable(), list.writer(r.gpa)); | 1108 | try std.compress.flate.inflate.decompress(.zlib, bufr.anyReadable(), list.writer(r.gpa)); |
| 1109 | | 1109 | |
| 1110 | std.log.debug("transformation data={d}", .{list.items}); | 1110 | // std.log.debug("transformation data={d}", .{list.items}); |
| 1111 | | 1111 | |
| 1112 | var unpackedobj_fbs = nio.FixedBufferStream([]const u8).init(list.items); | 1112 | var unpackedobj_fbs = nio.FixedBufferStream([]const u8).init(list.items); |
| 1113 | | 1113 | |
| ... | @@ -1121,7 +1121,7 @@ pub const Repository = struct { | ... | @@ -1121,7 +1121,7 @@ pub const Repository = struct { |
| 1121 | if (c2 & 0x80 == 0) break; | 1121 | if (c2 & 0x80 == 0) break; |
| 1122 | base_size += 1; | 1122 | base_size += 1; |
| 1123 | } | 1123 | } |
| 1124 | std.log.debug("base_size={d}", .{base_size}); | 1124 | // std.log.debug("base_size={d}", .{base_size}); |
| 1125 | | 1125 | |
| 1126 | var obj_size: usize = 0; | 1126 | var obj_size: usize = 0; |
| 1127 | while (true) { | 1127 | while (true) { |
| ... | @@ -1130,7 +1130,7 @@ pub const Repository = struct { | ... | @@ -1130,7 +1130,7 @@ pub const Repository = struct { |
| 1130 | if (c2 & 0x80 == 0) break; | 1130 | if (c2 & 0x80 == 0) break; |
| 1131 | obj_size += 1; | 1131 | obj_size += 1; |
| 1132 | } | 1132 | } |
| 1133 | std.log.debug("obj_size={d}", .{obj_size}); | 1133 | // std.log.debug("obj_size={d}", .{obj_size}); |
| 1134 | | 1134 | |
| 1135 | while (unpackedobj_fbs.pos < unpackedobj_fbs.buffer.len) { | 1135 | while (unpackedobj_fbs.pos < unpackedobj_fbs.buffer.len) { |
| 1136 | const c2 = unpackedobj_fbs.takeByte(); | 1136 | const c2 = unpackedobj_fbs.takeByte(); |
| ... | @@ -1143,14 +1143,14 @@ pub const Repository = struct { | ... | @@ -1143,14 +1143,14 @@ pub const Repository = struct { |
| 1143 | } | 1143 | } |
| 1144 | const start: u32 = @bitCast(b.items[0..4].*); | 1144 | const start: u32 = @bitCast(b.items[0..4].*); |
| 1145 | const nbytes: u24 = @bitCast(b.items[4..7].*); | 1145 | const nbytes: u24 = @bitCast(b.items[4..7].*); |
| 1146 | std.log.debug("- copy from base: start={d} nbytes={d}", .{ start, nbytes }); | 1146 | // std.log.debug("- copy from base: start={d} nbytes={d}", .{ start, nbytes }); |
| 1147 | const bytes = base_obj.content[start..][0..nbytes]; | 1147 | const bytes = base_obj.content[start..][0..nbytes]; |
| 1148 | // std.log.debug("{s}\n", .{bytes}); | 1148 | // std.log.debug("{s}\n", .{bytes}); |
| 1149 | try list2.appendSlice(r.gpa, bytes); | 1149 | try list2.appendSlice(r.gpa, bytes); |
| 1150 | } else { | 1150 | } else { |
| 1151 | // append new data | 1151 | // append new data |
| 1152 | const nbytes = c2 & 0x7f; | 1152 | const nbytes = c2 & 0x7f; |
| 1153 | std.log.debug("- append new bytes={d}", .{nbytes}); | 1153 | // std.log.debug("- append new bytes={d}", .{nbytes}); |
| 1154 | if (nbytes == 0) continue; | 1154 | if (nbytes == 0) continue; |
| 1155 | const bytes = unpackedobj_fbs.takeSlice(nbytes); | 1155 | const bytes = unpackedobj_fbs.takeSlice(nbytes); |
| 1156 | // std.log.debug("{s}\n", .{bytes}); | 1156 | // std.log.debug("{s}\n", .{bytes}); |
| ... | @@ -1158,7 +1158,7 @@ pub const Repository = struct { | ... | @@ -1158,7 +1158,7 @@ pub const Repository = struct { |
| 1158 | } | 1158 | } |
| 1159 | } | 1159 | } |
| 1160 | | 1160 | |
| 1161 | std.log.debug("- done", .{}); | 1161 | // std.log.debug("- done", .{}); |
| 1162 | // std.log.debug("{s}\n", .{list2.items}); | 1162 | // std.log.debug("{s}\n", .{list2.items}); |
| 1163 | const _type = base_obj.type; | 1163 | const _type = base_obj.type; |
| 1164 | const content = try list2.toOwnedSlice(r.gpa); | 1164 | const content = try list2.toOwnedSlice(r.gpa); |