Skip to content

Commit

Permalink
Merge pull request ziglang#19500 from ianic/package_filter_errors
Browse files Browse the repository at this point in the history
package manager: filter unpack errors on paths excluded by manifest
  • Loading branch information
andrewrk committed Apr 9, 2024
2 parents fc17402 + 4151e6c commit 215de3e
Show file tree
Hide file tree
Showing 8 changed files with 533 additions and 101 deletions.
17 changes: 6 additions & 11 deletions lib/std/tar.zig
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub const Diagnostics = struct {
errors: std.ArrayListUnmanaged(Error) = .{},

root_entries: usize = 0,
root_dir: ?[]const u8 = null,
root_dir: []const u8 = "",

pub const Error = union(enum) {
unable_to_create_sym_link: struct {
Expand All @@ -55,10 +55,8 @@ pub const Diagnostics = struct {
d.root_dir = try d.allocator.dupe(u8, root_dir);
return;
}
if (d.root_dir) |r| {
d.allocator.free(r);
d.root_dir = null;
}
d.allocator.free(d.root_dir);
d.root_dir = "";
}
}

Expand Down Expand Up @@ -103,10 +101,7 @@ pub const Diagnostics = struct {
}
}
d.errors.deinit(d.allocator);
if (d.root_dir) |r| {
d.allocator.free(r);
d.root_dir = null;
}
d.allocator.free(d.root_dir);
d.* = undefined;
}
};
Expand Down Expand Up @@ -1060,7 +1055,7 @@ test "pipeToFileSystem root_dir" {
};

// there is no root_dir
try testing.expect(diagnostics.root_dir == null);
try testing.expectEqual(0, diagnostics.root_dir.len);
try testing.expectEqual(3, diagnostics.root_entries);
}

Expand All @@ -1082,7 +1077,7 @@ test "pipeToFileSystem root_dir" {
};

// root_dir found
try testing.expectEqualStrings("example", diagnostics.root_dir.?);
try testing.expectEqualStrings("example", diagnostics.root_dir);
try testing.expectEqual(1, diagnostics.root_entries);
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Package.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ pub const Module = @import("Package/Module.zig");
pub const Fetch = @import("Package/Fetch.zig");
pub const build_zig_basename = "build.zig";
pub const Manifest = @import("Package/Manifest.zig");

test {
_ = Fetch;
}

0 comments on commit 215de3e

Please sign in to comment.