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