mirror of
https://github.com/oven-sh/bun
synced 2026-02-19 23:31:45 +00:00
fixes
This commit is contained in:
@@ -143,12 +143,7 @@ pub const FilterSet = struct {
|
||||
};
|
||||
|
||||
pub fn init(allocator: std.mem.Allocator, filters: []const []const u8, cwd_: []const u8) !FilterSet {
|
||||
const cwd: []const u8 = if (comptime bun.Environment.isWindows) brk: {
|
||||
const c = try allocator.dupe(u8, cwd_);
|
||||
std.mem.replaceScalar(u8, c, '\\', '/');
|
||||
break :brk c;
|
||||
} else cwd_;
|
||||
defer if (comptime bun.Environment.isWindows) allocator.free(cwd);
|
||||
const cwd = cwd_;
|
||||
|
||||
var buf: bun.PathBuffer = undefined;
|
||||
// TODO fixed buffer allocator with fallback?
|
||||
@@ -164,7 +159,9 @@ pub const FilterSet = struct {
|
||||
const is_path = filter_utf8.len > 0 and filter_utf8[0] == '.';
|
||||
if (is_path) {
|
||||
const parts = [_]string{filter_utf8};
|
||||
filter_utf8 = try allocator.dupe(u8, bun.path.joinAbsStringBuf(cwd, &buf, &parts, .loose));
|
||||
const filter_utf8_temp = try allocator.dupe(u8, bun.path.joinAbsStringBuf(cwd, &buf, &parts, .loose));
|
||||
std.mem.replaceScalar(u8, filter_utf8_temp, '\\', '/');
|
||||
filter_utf8 = filter_utf8_temp;
|
||||
try list.append(.{
|
||||
.pattern = filter_utf8,
|
||||
.kind = .path,
|
||||
|
||||
@@ -159,7 +159,7 @@ inline fn globMatchImpl(state: *State, glob: []const u8, path: []const u8) bool
|
||||
const is_end_invalid = state.glob_index < glob.len;
|
||||
|
||||
// FIXME: explain this bug fix
|
||||
if (is_end_invalid and state.path_index == path.len and glob.len - state.glob_index == 2 and glob[state.glob_index] == '/' and glob[state.glob_index + 1] == '*') {
|
||||
if (is_end_invalid and state.path_index == path.len and glob.len - state.glob_index == 2 and isSeparator(glob[state.glob_index]) and glob[state.glob_index + 1] == '*') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user