upgraded dependencies
This commit is contained in:
14
vendor/symfony/finder/Gitignore.php
vendored
14
vendor/symfony/finder/Gitignore.php
vendored
@@ -25,12 +25,22 @@ class Gitignore
|
||||
* Format specification: https://git-scm.com/docs/gitignore#_pattern_format
|
||||
*/
|
||||
public static function toRegex(string $gitignoreFileContent): string
|
||||
{
|
||||
return self::buildRegex($gitignoreFileContent, false);
|
||||
}
|
||||
|
||||
public static function toRegexMatchingNegatedPatterns(string $gitignoreFileContent): string
|
||||
{
|
||||
return self::buildRegex($gitignoreFileContent, true);
|
||||
}
|
||||
|
||||
private static function buildRegex(string $gitignoreFileContent, bool $inverted): string
|
||||
{
|
||||
$gitignoreFileContent = preg_replace('~(?<!\\\\)#[^\n\r]*~', '', $gitignoreFileContent);
|
||||
$gitignoreLines = preg_split('~\r\n?|\n~', $gitignoreFileContent);
|
||||
|
||||
$res = self::lineToRegex('');
|
||||
foreach ($gitignoreLines as $i => $line) {
|
||||
foreach ($gitignoreLines as $line) {
|
||||
$line = preg_replace('~(?<!\\\\)[ \t]+$~', '', $line);
|
||||
|
||||
if ('!' === substr($line, 0, 1)) {
|
||||
@@ -41,7 +51,7 @@ class Gitignore
|
||||
}
|
||||
|
||||
if ('' !== $line) {
|
||||
if ($isNegative) {
|
||||
if ($isNegative xor $inverted) {
|
||||
$res = '(?!'.self::lineToRegex($line).'$)'.$res;
|
||||
} else {
|
||||
$res = '(?:'.$res.'|'.self::lineToRegex($line).')';
|
||||
|
Reference in New Issue
Block a user