| ... | ... | @@ -1658,23 +1658,37 @@ pub const Repository = struct { |
| 1658 | 1658 | |
| 1659 | 1659 | var prev_prev_commit: ?*Commit = null; |
| 1660 | 1660 | var prev_commit = base; |
| 1661 | | var prev_tree = base_id_parent; |
| 1661 | var prev_tree: ?*Tree = base_id_parent; |
| 1662 | 1662 | var prev_obj = try r.gpa.create(Tree.Object); |
| 1663 | 1663 | prev_obj.* = base_obj.*; |
| 1664 | 1664 | defer r.gpa.destroy(prev_obj); |
| 1665 | 1665 | |
| 1666 | 1666 | while (true) { |
| 1667 | 1667 | if (prev_commit.parents.len == 0) { |
| 1668 | | try list.appendSlice(alloc, prev_prev_commit.?.parents[0].id ++ "\n"); |
| 1668 | if (prev_tree != null) { |
| 1669 | try list.appendSlice(alloc, prev_prev_commit.?.parents[0].id ++ "\n"); |
| 1670 | } |
| 1669 | 1671 | break; |
| 1670 | 1672 | } |
| 1671 | 1673 | const next_commit = try r.getCommitA(prev_commit.parents[0].id, .no_cache); |
| 1672 | 1674 | const next_commit_tree = try r.getTreeA(next_commit.tree.id, .no_cache); |
| 1673 | 1675 | const next_obj, const next_tree = try idFor(r, next_commit_tree, sub_path) orelse { |
| 1676 | if (prev_tree == null) { |
| 1677 | if (prev_prev_commit) |p| p.destroy(r); |
| 1678 | prev_prev_commit = prev_commit; |
| 1679 | prev_commit = next_commit; |
| 1680 | prev_tree = null; |
| 1681 | continue; |
| 1682 | } |
| 1674 | 1683 | try list.appendSlice(alloc, prev_prev_commit.?.parents[0].id ++ "\n"); |
| 1675 | | break; |
| 1684 | // break; // we don't pass --remove-empty |
| 1685 | if (prev_prev_commit) |p| p.destroy(r); |
| 1686 | prev_prev_commit = prev_commit; |
| 1687 | prev_commit = next_commit; |
| 1688 | prev_tree = null; |
| 1689 | continue; |
| 1676 | 1690 | }; |
| 1677 | | if (std.mem.eql(u8, &next_obj.id_bytes, &prev_obj.id_bytes) and next_obj.mode.eql(prev_obj.mode)) { |
| 1691 | if (prev_tree != null and std.mem.eql(u8, &next_obj.id_bytes, &prev_obj.id_bytes) and next_obj.mode.eql(prev_obj.mode)) { |
| 1678 | 1692 | if (prev_prev_commit) |p| p.destroy(r); |
| 1679 | 1693 | prev_prev_commit = prev_commit; |
| 1680 | 1694 | prev_commit = next_commit; |