| ... | @@ -406,11 +406,15 @@ pub fn parseTreeDiff(alloc: std.mem.Allocator, input: string) !TreeDiff { | ... | @@ -406,11 +406,15 @@ pub fn parseTreeDiff(alloc: std.mem.Allocator, input: string) !TreeDiff { |
| 406 | .index = @splat(.{ .id = "0000000000000000000000000000000000000000" }), | 406 | .index = @splat(.{ .id = "0000000000000000000000000000000000000000" }), |
| 407 | .before_path = overview.items[i].sub_path, | 407 | .before_path = overview.items[i].sub_path, |
| 408 | .after_path = overview.items[i].sub_path, | 408 | .after_path = overview.items[i].sub_path, |
| | 409 | .before_mode = overview.items[i].before.mode, |
| | 410 | .after_mode = overview.items[i].after.mode, |
| 409 | .subs = 0, | 411 | .subs = 0, |
| 410 | .adds = 0, | 412 | .adds = 0, |
| 411 | .content = "", | 413 | .content = "", |
| 412 | }); | 414 | }); |
| 413 | const diff = &diffs.items[diffs.items.len - 1]; | 415 | const diff = &diffs.items[diffs.items.len - 1]; |
| | 416 | if (overview.items[i].action == .T) diff.before_mode = .none; |
| | 417 | if (overview.items[i].action == .T) diff.after_mode = .none; |
| 414 | | 418 | |
| 415 | while (true) { | 419 | while (true) { |
| 416 | if (lineiter.index.? >= input.len) { | 420 | if (lineiter.index.? >= input.len) { |
| ... | @@ -429,19 +433,23 @@ pub fn parseTreeDiff(alloc: std.mem.Allocator, input: string) !TreeDiff { | ... | @@ -429,19 +433,23 @@ pub fn parseTreeDiff(alloc: std.mem.Allocator, input: string) !TreeDiff { |
| 429 | lineiter.index.? += lin.len + 1; | 433 | lineiter.index.? += lin.len + 1; |
| 430 | break; | 434 | break; |
| 431 | } | 435 | } |
| 432 | if (std.mem.startsWith(u8, lin, "new file mode")) { | 436 | if (extras.trimPrefixEnsure(lin, "new file mode ")) |sl| { |
| | 437 | diff.after_mode = parseTreeMode(sl) catch unreachable; |
| 433 | lineiter.index.? += lin.len + 1; | 438 | lineiter.index.? += lin.len + 1; |
| 434 | continue; | 439 | continue; |
| 435 | } | 440 | } |
| 436 | if (std.mem.startsWith(u8, lin, "deleted file mode")) { | 441 | if (extras.trimPrefixEnsure(lin, "deleted file mode ")) |sl| { |
| | 442 | diff.before_mode = parseTreeMode(sl) catch unreachable; |
| 437 | lineiter.index.? += lin.len + 1; | 443 | lineiter.index.? += lin.len + 1; |
| 438 | continue; | 444 | continue; |
| 439 | } | 445 | } |
| 440 | if (std.mem.startsWith(u8, lin, "old mode")) { | 446 | if (extras.trimPrefixEnsure(lin, "old mode ")) |sl| { |
| | 447 | diff.before_mode = parseTreeMode(sl) catch unreachable; |
| 441 | lineiter.index.? += lin.len + 1; | 448 | lineiter.index.? += lin.len + 1; |
| 442 | continue; | 449 | continue; |
| 443 | } | 450 | } |
| 444 | if (std.mem.startsWith(u8, lin, "new mode")) { | 451 | if (extras.trimPrefixEnsure(lin, "new mode ")) |sl| { |
| | 452 | diff.after_mode = parseTreeMode(sl) catch unreachable; |
| 445 | lineiter.index.? += lin.len + 1; | 453 | lineiter.index.? += lin.len + 1; |
| 446 | continue; | 454 | continue; |
| 447 | } | 455 | } |
| ... | @@ -562,6 +570,8 @@ pub const TreeDiff = struct { | ... | @@ -562,6 +570,8 @@ pub const TreeDiff = struct { |
| 562 | index: [2]CommitId, | 570 | index: [2]CommitId, |
| 563 | before_path: string, | 571 | before_path: string, |
| 564 | after_path: string, | 572 | after_path: string, |
| | 573 | before_mode: Tree.Object.Mode, |
| | 574 | after_mode: Tree.Object.Mode, |
| 565 | adds: u32, | 575 | adds: u32, |
| 566 | subs: u32, | 576 | subs: u32, |
| 567 | content: string, | 577 | content: string, |