Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5a7f2a5

Browse files
committed
add rtrim tabs incl. test
1 parent b6ede39 commit 5a7f2a5

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 ('!' === substr($line, 0, 1)) {
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
@@ -122,6 +122,11 @@ public function provider(): array
122122
[' ', ' ', 'a', 'a ', 'a '],
123123
[' ', ' ', 'a ', 'a '],
124124
],
125+
[
126+
["\t", "\t\\\t", " \t\\\t ", "\t#", "a\t#", "a\t\t#", "a \t#", "a\t\t\\\t#", "a \t\t\\\t\t#"],
127+
["\t\t", " \t\t", 'a', "a\t\t\t", "a \t\t\t"],
128+
["\t", "\t\t ", " \t\t ", "a\t", 'a ', "a \t", "a\t\t"],
129+
],
125130
[
126131
[' a', 'b ', '\ ', 'c\ '],
127132
[' a', 'b', ' ', 'c '],

0 commit comments

Comments
 (0)