mirror of
https://github.com/ziglang/zig.git
synced 2024-12-03 10:28:48 +00:00
fetch: fix manifest included paths filtering
Filter should be applied on path where package root folder (if there is any) is stripped. Manifest is inside package root and has paths relative to package root not temporary directory root.
This commit is contained in:
parent
8545cb0147
commit
a60b7af2c1
@ -1416,7 +1416,8 @@ fn computeHash(
|
||||
}) |entry| {
|
||||
if (entry.kind == .directory) continue;
|
||||
|
||||
if (!filter.includePath(entry.path)) {
|
||||
const entry_pkg_path = stripRoot(entry.path, pkg_path.sub_path);
|
||||
if (!filter.includePath(entry_pkg_path)) {
|
||||
// Delete instead of including in hash calculation.
|
||||
const fs_path = try arena.dupe(u8, entry.path);
|
||||
|
||||
@ -1454,7 +1455,7 @@ fn computeHash(
|
||||
const hashed_file = try arena.create(HashedFile);
|
||||
hashed_file.* = .{
|
||||
.fs_path = fs_path,
|
||||
.normalized_path = try normalizePathAlloc(arena, stripRoot(fs_path, pkg_path.sub_path)),
|
||||
.normalized_path = try normalizePathAlloc(arena, entry_pkg_path),
|
||||
.kind = kind,
|
||||
.hash = undefined, // to be populated by the worker
|
||||
.failure = undefined, // to be populated by the worker
|
||||
@ -1657,9 +1658,9 @@ fn stripRoot(fs_path: []const u8, root_dir: []const u8) []const u8 {
|
||||
|
||||
/// Make a file system path identical independently of operating system path inconsistencies.
|
||||
/// This converts backslashes into forward slashes.
|
||||
fn normalizePathAlloc(arena: Allocator, fs_path: []const u8) ![]const u8 {
|
||||
if (fs.path.sep == canonical_sep) return fs_path;
|
||||
const normalized = try arena.dupe(u8, fs_path);
|
||||
fn normalizePathAlloc(arena: Allocator, pkg_path: []const u8) ![]const u8 {
|
||||
const normalized = try arena.dupe(u8, pkg_path);
|
||||
if (fs.path.sep == canonical_sep) return normalized;
|
||||
normalizePath(normalized);
|
||||
return normalized;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user