Skip to content

Commit e859ae5

Browse files
committed
add rtrim tabs incl. test
1 parent bd4a73a commit e859ae5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Symfony/Component/Finder/Gitignore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static function toRegex(string $gitignoreFileContent): string
3131

3232
$res = self::lineToRegex('');
3333
foreach ($gitignoreLines as $i => $line) {
34-
$line = preg_replace('~(?<!\\\\) +$~', '', $line);
34+
$line = preg_replace('~(?<!\\\\)[ \t]+$~', '', $line);
3535

3636
if (0 === strpos($line, '!')) {
3737
$line = substr($line, 1);

src/Symfony/Component/Finder/Tests/GitignoreTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ public function provider(): array
117117
[' ', ' ', 'a', 'a ', 'a '],
118118
[' ', ' ', 'a ', 'a '],
119119
],
120+
[
121+
["\t", "\t\\\t", " \t\\\t ", "\t#", "a\t#", "a\t\t#", "a \t#", "a\t\t\\\t#", "a \t\t\\\t\t#"],
122+
["\t\t", " \t\t", "a", "a\t\t\t", "a \t\t\t"],
123+
["\t", "\t\t ", " \t\t ", "a\t", "a ", "a \t", "a\t\t"],
124+
],
120125
[
121126
[' a', 'b ', '\ ', 'c\ '],
122127
[' a', 'b', ' ', 'c '],

0 commit comments

Comments
 (0)