| ... | @@ -1291,8 +1291,8 @@ pub const Repository = struct { | ... | @@ -1291,8 +1291,8 @@ pub const Repository = struct { |
| 1291 | | 1291 | |
| 1292 | pub fn diffFileIterator(r: *Repository, writable: anytype, commitid_from: ?CommitId, commitid_to: CommitId, S: type) !void { | 1292 | pub fn diffFileIterator(r: *Repository, writable: anytype, commitid_from: ?CommitId, commitid_to: CommitId, S: type) !void { |
| 1293 | const A = struct { | 1293 | const A = struct { |
| 1294 | fn item(w: anytype, mode: Tree.Object.Mode, id: Id, p: ?*const PathListNode, name: []const u8) !void { | 1294 | fn item(e: *Repository, w: anytype, mode: Tree.Object.Mode, id: Id, p: ?*const PathListNode, name: []const u8) !void { |
| 1295 | try S.item(w, .none, mode, &@splat('0'), id, .A, p, name); | 1295 | try S.item(e, w, .none, mode, &@splat('0'), id, .A, p, name); |
| 1296 | } | 1296 | } |
| 1297 | fn dir(e: *Repository, w: anytype, t: Id, p: ?*const PathListNode, o: usize) !void { | 1297 | fn dir(e: *Repository, w: anytype, t: Id, p: ?*const PathListNode, o: usize) !void { |
| 1298 | const tree = try e.getTreeA(e.gpa, t); | 1298 | const tree = try e.getTreeA(e.gpa, t); |
| ... | @@ -1301,19 +1301,19 @@ pub const Repository = struct { | ... | @@ -1301,19 +1301,19 @@ pub const Repository = struct { |
| 1301 | try dir(e, w, obj.id.tree.id, &.{ .prev = p, .data = obj.name }, 0); | 1301 | try dir(e, w, obj.id.tree.id, &.{ .prev = p, .data = obj.name }, 0); |
| 1302 | continue; | 1302 | continue; |
| 1303 | } | 1303 | } |
| 1304 | try item(w, obj.mode, obj.id.erase(), p, obj.name); | 1304 | try item(e, w, obj.mode, obj.id.erase(), p, obj.name); |
| 1305 | } | 1305 | } |
| 1306 | } | 1306 | } |
| 1307 | pub fn either(e: *Repository, w: anytype, p: ?*const PathListNode, obj: Tree.Object) !void { | 1307 | pub fn either(e: *Repository, w: anytype, p: ?*const PathListNode, obj: Tree.Object) !void { |
| 1308 | if (obj.mode.type == .directory) { | 1308 | if (obj.mode.type == .directory) { |
| 1309 | return dir(e, w, obj.id.tree.id, &.{ .prev = p, .data = obj.name }, 0); | 1309 | return dir(e, w, obj.id.tree.id, &.{ .prev = p, .data = obj.name }, 0); |
| 1310 | } | 1310 | } |
| 1311 | return item(w, obj.mode, obj.id.erase(), p, obj.name); | 1311 | return item(e, w, obj.mode, obj.id.erase(), p, obj.name); |
| 1312 | } | 1312 | } |
| 1313 | }; | 1313 | }; |
| 1314 | const D = struct { | 1314 | const D = struct { |
| 1315 | fn item(w: anytype, mode: Tree.Object.Mode, id: Id, p: ?*const PathListNode, name: []const u8) !void { | 1315 | fn item(e: *Repository, w: anytype, mode: Tree.Object.Mode, id: Id, p: ?*const PathListNode, name: []const u8) !void { |
| 1316 | try S.item(w, mode, .none, id, &@splat('0'), .D, p, name); | 1316 | try S.item(e, w, mode, .none, id, &@splat('0'), .D, p, name); |
| 1317 | } | 1317 | } |
| 1318 | fn dir(e: *Repository, w: anytype, t: Id, p: ?*const PathListNode, o: usize) !void { | 1318 | fn dir(e: *Repository, w: anytype, t: Id, p: ?*const PathListNode, o: usize) !void { |
| 1319 | const tree = try e.getTreeA(e.gpa, t); | 1319 | const tree = try e.getTreeA(e.gpa, t); |
| ... | @@ -1322,14 +1322,14 @@ pub const Repository = struct { | ... | @@ -1322,14 +1322,14 @@ pub const Repository = struct { |
| 1322 | try dir(e, w, obj.id.tree.id, &.{ .prev = p, .data = obj.name }, 0); | 1322 | try dir(e, w, obj.id.tree.id, &.{ .prev = p, .data = obj.name }, 0); |
| 1323 | continue; | 1323 | continue; |
| 1324 | } | 1324 | } |
| 1325 | try item(w, obj.mode, obj.id.erase(), p, obj.name); | 1325 | try item(e, w, obj.mode, obj.id.erase(), p, obj.name); |
| 1326 | } | 1326 | } |
| 1327 | } | 1327 | } |
| 1328 | pub fn either(e: *Repository, w: anytype, p: ?*const PathListNode, obj: Tree.Object) !void { | 1328 | pub fn either(e: *Repository, w: anytype, p: ?*const PathListNode, obj: Tree.Object) !void { |
| 1329 | if (obj.mode.type == .directory) { | 1329 | if (obj.mode.type == .directory) { |
| 1330 | return dir(e, w, obj.id.tree.id, &.{ .prev = p, .data = obj.name }, 0); | 1330 | return dir(e, w, obj.id.tree.id, &.{ .prev = p, .data = obj.name }, 0); |
| 1331 | } | 1331 | } |
| 1332 | return item(w, obj.mode, obj.id.erase(), p, obj.name); | 1332 | return item(e, w, obj.mode, obj.id.erase(), p, obj.name); |
| 1333 | } | 1333 | } |
| 1334 | }; | 1334 | }; |
| 1335 | const M = struct { | 1335 | const M = struct { |
| ... | @@ -1360,6 +1360,7 @@ pub const Repository = struct { | ... | @@ -1360,6 +1360,7 @@ pub const Repository = struct { |
| 1360 | if (std.mem.eql(u8, before.id.erase(), after.id.erase())) { | 1360 | if (std.mem.eql(u8, before.id.erase(), after.id.erase())) { |
| 1361 | if (!std.mem.eql(u8, &before.mode.intbytes(), &after.mode.intbytes())) { | 1361 | if (!std.mem.eql(u8, &before.mode.intbytes(), &after.mode.intbytes())) { |
| 1362 | try S.item( | 1362 | try S.item( |
| | 1363 | e, |
| 1363 | w, | 1364 | w, |
| 1364 | before.mode, | 1365 | before.mode, |
| 1365 | after.mode, | 1366 | after.mode, |
| ... | @@ -1376,6 +1377,7 @@ pub const Repository = struct { | ... | @@ -1376,6 +1377,7 @@ pub const Repository = struct { |
| 1376 | } | 1377 | } |
| 1377 | if (before.mode.type != after.mode.type) { | 1378 | if (before.mode.type != after.mode.type) { |
| 1378 | try S.item( | 1379 | try S.item( |
| | 1380 | e, |
| 1379 | w, | 1381 | w, |
| 1380 | before.mode, | 1382 | before.mode, |
| 1381 | after.mode, | 1383 | after.mode, |
| ... | @@ -1402,6 +1404,7 @@ pub const Repository = struct { | ... | @@ -1402,6 +1404,7 @@ pub const Repository = struct { |
| 1402 | continue; | 1404 | continue; |
| 1403 | } | 1405 | } |
| 1404 | try S.item( | 1406 | try S.item( |
| | 1407 | e, |
| 1405 | w, | 1408 | w, |
| 1406 | before.mode, | 1409 | before.mode, |
| 1407 | after.mode, | 1410 | after.mode, |
| ... | @@ -1491,7 +1494,8 @@ pub const Repository = struct { | ... | @@ -1491,7 +1494,8 @@ pub const Repository = struct { |
| 1491 | | 1494 | |
| 1492 | pub fn writeTreeDiffOnlyRaw(r: *Repository, writable: anytype, commitid: CommitId, parentid: ?CommitId) !void { | 1495 | pub fn writeTreeDiffOnlyRaw(r: *Repository, writable: anytype, commitid: CommitId, parentid: ?CommitId) !void { |
| 1493 | const S = struct { | 1496 | const S = struct { |
| 1494 | fn item(w: anytype, b_mode: Tree.Object.Mode, a_mode: Tree.Object.Mode, b_id: Id, a_id: Id, action: TreeDiff.Action, p: ?*const PathListNode, name: []const u8) !void { | 1497 | fn item(e: *Repository, w: anytype, b_mode: Tree.Object.Mode, a_mode: Tree.Object.Mode, b_id: Id, a_id: Id, action: TreeDiff.Action, p: ?*const PathListNode, name: []const u8) !void { |
| | 1498 | _ = e; |
| 1495 | if (p == null) { | 1499 | if (p == null) { |
| 1496 | try w.writevAll(&.{ ":", &b_mode.intbytes(), " ", &a_mode.intbytes(), " ", b_id, " ", a_id, " ", @tagName(action), "\t", name, "\n" }); | 1500 | try w.writevAll(&.{ ":", &b_mode.intbytes(), " ", &a_mode.intbytes(), " ", b_id, " ", a_id, " ", @tagName(action), "\t", name, "\n" }); |
| 1497 | return; | 1501 | return; |
| ... | @@ -1506,7 +1510,8 @@ pub const Repository = struct { | ... | @@ -1506,7 +1510,8 @@ pub const Repository = struct { |
| 1506 | | 1510 | |
| 1507 | pub fn writeTreeDiffOnlySummary(r: *Repository, writable: anytype, commitid: CommitId, parentid: ?CommitId) !void { | 1511 | pub fn writeTreeDiffOnlySummary(r: *Repository, writable: anytype, commitid: CommitId, parentid: ?CommitId) !void { |
| 1508 | const S = struct { | 1512 | const S = struct { |
| 1509 | fn item(w: anytype, b_mode: Tree.Object.Mode, a_mode: Tree.Object.Mode, b_id: Id, a_id: Id, action: TreeDiff.Action, p: ?*const PathListNode, name: []const u8) !void { | 1513 | fn item(e: *Repository, w: anytype, b_mode: Tree.Object.Mode, a_mode: Tree.Object.Mode, b_id: Id, a_id: Id, action: TreeDiff.Action, p: ?*const PathListNode, name: []const u8) !void { |
| | 1514 | _ = e; |
| 1510 | _ = b_id; | 1515 | _ = b_id; |
| 1511 | _ = a_id; | 1516 | _ = a_id; |
| 1512 | switch (action) { | 1517 | switch (action) { |