in src/shipit/filter/ShipItPathFilters.php [23:66]
public static function stripPaths(
ShipItChangeset $changeset,
vec<string> $strip_patterns,
vec<string> $strip_exception_patterns = vec[],
): ShipItChangeset {
if (C\is_empty($strip_patterns)) {
return $changeset;
}
$diffs = vec[];
$use_debug = C\count($changeset->getDiffs()) < self::LARGE_CHANGESET;
foreach ($changeset->getDiffs() as $diff) {
$path = $diff['path'];
$match = self::matchesAnyPattern($path, $strip_exception_patterns);
if ($match !== null) {
$diffs[] = $diff;
if ($use_debug) {
$changeset = $changeset->withDebugMessage(
'STRIP FILE EXCEPTION: "%s" matches pattern "%s"',
$path,
$match,
);
}
continue;
}
$match = self::matchesAnyPattern($path, $strip_patterns);
if ($match !== null) {
if ($use_debug) {
$changeset = $changeset->withDebugMessage(
'STRIP FILE: "%s" matches pattern "%s"',
$path,
$match,
);
}
continue;
}
$diffs[] = $diff;
}
return $changeset->withDiffs($diffs);
}