Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package manager: filter unpack errors on paths excluded by manifest #19500

Merged
merged 18 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
Loading