authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-04 20:32:48 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2023-05-04 20:32:48 -07:00
log8cac0cbd46ecdd17bc76b3e136724e2b67f5d55b
tree71fe5ab61c0c8459eaeb7947d62ea065374d1cdc
parent259015937048a1ff820ded783ab65376b8f79f4b

handle binary file diffs better


1 files changed, 14 insertions(+), 1 deletions(-)

git.zig+14-1
...@@ -312,13 +312,17 @@ pub fn parseTreeDiffMeta(input: string) !TreeDiffMeta {...@@ -312,13 +312,17 @@ pub fn parseTreeDiffMeta(input: string) !TreeDiffMeta {
312 'd' => continue, // diff --git a/src/Sema.zig b/src/Sema.zig312 'd' => continue, // diff --git a/src/Sema.zig b/src/Sema.zig
313 // deleted file mode 100644313 // deleted file mode 100644
314 'n' => continue, // new file mode 100644314 'n' => continue, // new file mode 100644
315 'B' => continue, // Binary files a/stage1/zig1.wasm and b/stage1/zig1.wasm differ
316 'i' => continue, // index 327ff3800..df199be97 100644315 'i' => continue, // index 327ff3800..df199be97 100644
317 '@' => continue, // @@ -24629,10 +24634,11 @@316 '@' => continue, // @@ -24629,10 +24634,11 @@
318 ' ' => continue,317 ' ' => continue,
319 '+' => result.lines_added += 1,318 '+' => result.lines_added += 1,
320 '-' => result.lines_removed += 1,319 '-' => result.lines_removed += 1,
321 '\\' => continue, // \ No newline at end of file320 '\\' => continue, // \ No newline at end of file
321 'B' => {
322 // Binary files a/stage1/zig1.wasm and b/stage1/zig1.wasm differ
323 result.lines_added += 1;
324 result.lines_removed += 1;
325 },
322 else => {326 else => {
323 std.log.err("{s}", .{lin});327 std.log.err("{s}", .{lin});
324 std.log.err("{s}", .{input});328 std.log.err("{s}", .{input});
...@@ -397,6 +401,15 @@ pub fn parseTreeDiff(alloc: std.mem.Allocator, input: string) !TreeDiff {...@@ -397,6 +401,15 @@ pub fn parseTreeDiff(alloc: std.mem.Allocator, input: string) !TreeDiff {
397 }401 }
398402
399 const before_path_raw = lineiter.next().?;403 const before_path_raw = lineiter.next().?;
404 if (std.mem.startsWith(u8, before_path_raw, "Binary files")) {
405 try diffs.append(.{
406 .before_path = overview.items[diffs.items.len].sub_path,
407 .after_path = overview.items[diffs.items.len].sub_path,
408 .content = before_path_raw,
409 });
410 _ = lineiter.index orelse break :blk;
411 continue :blk;
412 }
400 const before_path = extras.trimPrefixEnsure(before_path_raw, "--- a/") orelse extras.trimPrefixEnsure(before_path_raw, "--- ").?;413 const before_path = extras.trimPrefixEnsure(before_path_raw, "--- a/") orelse extras.trimPrefixEnsure(before_path_raw, "--- ").?;
401414
402 const after_path_raw = lineiter.next().?;415 const after_path_raw = lineiter.next().?;