| ... | ... | @@ -1111,8 +1111,7 @@ pub const Repository = struct { |
| 1111 | 1111 | i += name_end + 1; |
| 1112 | 1112 | |
| 1113 | 1113 | const oid_raw = obj.content[i..][0..20].*; |
| 1114 | | const oid_hex = (try arena.alloc(u8, 40))[0..40]; |
| 1115 | | oid_hex.* = extras.to_hex(oid_raw); |
| 1114 | const oid_hex = extras.to_hex(oid_raw); |
| 1116 | 1115 | i += 20; |
| 1117 | 1116 | |
| 1118 | 1117 | var mode_buf: [6]u8 = @splat('0'); |
| ... | ... | @@ -1122,18 +1121,20 @@ pub const Repository = struct { |
| 1122 | 1121 | try children.append(r.gpa, .{ |
| 1123 | 1122 | .mode = mode_real, |
| 1124 | 1123 | .name = name, |
| 1125 | | .id = switch (mode_real.type) { |
| 1126 | | .file => .{ .blob = .{ .id = oid_hex } }, |
| 1127 | | .directory => .{ .tree = .{ .id = oid_hex } }, |
| 1128 | | .submodule => .{ .commit = .{ .id = oid_hex } }, |
| 1129 | | .symlink => .{ .blob = .{ .id = oid_hex } }, |
| 1130 | | .none => unreachable, |
| 1131 | | }, |
| 1124 | .id_bytes = oid_hex, |
| 1125 | .id = undefined, |
| 1132 | 1126 | }); |
| 1133 | 1127 | } |
| 1134 | 1128 | |
| 1135 | 1129 | const children_slice = try children.toOwnedSlice(r.gpa); |
| 1136 | 1130 | errdefer r.gpa.free(children_slice); |
| 1131 | for (children_slice) |*item| item.id = switch (item.mode.type) { |
| 1132 | .file => .{ .blob = .{ .id = &item.id_bytes } }, |
| 1133 | .directory => .{ .tree = .{ .id = &item.id_bytes } }, |
| 1134 | .submodule => .{ .commit = .{ .id = &item.id_bytes } }, |
| 1135 | .symlink => .{ .blob = .{ .id = &item.id_bytes } }, |
| 1136 | .none => unreachable, |
| 1137 | }; |
| 1137 | 1138 | const tree: Tree = .{ .children = children_slice }; |
| 1138 | 1139 | try r.trees.put(r.gpa, id.id, tree); |
| 1139 | 1140 | return .{ id, tree }; |
| ... | ... | @@ -1419,6 +1420,7 @@ pub const Tree = struct { |
| 1419 | 1420 | |
| 1420 | 1421 | pub const Object = struct { |
| 1421 | 1422 | mode: Mode, |
| 1423 | id_bytes: [40]u8, |
| 1422 | 1424 | id: AnyId, |
| 1423 | 1425 | name: [:0]const u8, |
| 1424 | 1426 | |