| ... | ... | @@ -518,6 +518,8 @@ pub fn parseTreeDiff(alloc: std.mem.Allocator, input: string) !TreeDiff { |
| 518 | 518 | }, |
| 519 | 519 | .action = std.meta.stringToEnum(TreeDiff.Action, action_s).?, |
| 520 | 520 | .sub_path = kter.rest(), |
| 521 | .adds = 0, |
| 522 | .subs = 0, |
| 521 | 523 | }); |
| 522 | 524 | } |
| 523 | 525 | |
| ... | ... | @@ -581,18 +583,24 @@ pub fn parseTreeDiff(alloc: std.mem.Allocator, input: string) !TreeDiff { |
| 581 | 583 | while (lineiter.next()) |lin| { |
| 582 | 584 | if (std.mem.startsWith(u8, lin, "diff --git")) { |
| 583 | 585 | const end_index = lineiter.index.? - lin.len - 2; |
| 586 | const content = input[start_index..end_index]; |
| 587 | overview.items[diffs.items.len].adds = @intCast(std.mem.count(u8, content, "\n+")); |
| 588 | overview.items[diffs.items.len].subs = @intCast(std.mem.count(u8, content, "\n-")); |
| 584 | 589 | try diffs.append(.{ |
| 585 | 590 | .before_path = before_path, |
| 586 | 591 | .after_path = after_path, |
| 587 | | .content = input[start_index..end_index], |
| 592 | .content = content, |
| 588 | 593 | }); |
| 589 | 594 | continue :blk; |
| 590 | 595 | } |
| 591 | 596 | } |
| 597 | const content = input[start_index..]; |
| 598 | overview.items[diffs.items.len].adds = @intCast(std.mem.count(u8, content, "\n+")); |
| 599 | overview.items[diffs.items.len].subs = @intCast(std.mem.count(u8, content, "\n-")); |
| 592 | 600 | try diffs.append(.{ |
| 593 | 601 | .before_path = before_path, |
| 594 | 602 | .after_path = after_path, |
| 595 | | .content = input[start_index..], |
| 603 | .content = content, |
| 596 | 604 | }); |
| 597 | 605 | break :blk; |
| 598 | 606 | } |
| ... | ... | @@ -612,6 +620,8 @@ pub const TreeDiff = struct { |
| 612 | 620 | after: State, |
| 613 | 621 | action: Action, |
| 614 | 622 | sub_path: string, |
| 623 | adds: u16, |
| 624 | subs: u16, |
| 615 | 625 | }; |
| 616 | 626 | |
| 617 | 627 | pub const State = struct { |