Skip to content

Commit bafd510

Browse files
committed
Merge branch '4.4'
* 4.4: [Twig] Remove dead code Minor updates in the new Welcome page Add gitignore file for Symfony 4.3 Add gitignore file for Symfony 3.4 [Inflector] Add .gitignore file [Messenger] Fix exception message of failed message is dropped on retry Add default value for Accept header [HttpClient] Add .gitignore file [Finder] Adjust regex to correctly match comments in gitignore contents [Security] Removed unused argument in Test [Console] Get dimensions from stty on windows if possible [Inflector] add support 'see' to 'ee' for singularize 'fees' to 'fee'
2 parents 78aae33 + 30898bb commit bafd510

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

Gitignore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Gitignore
2525
*/
2626
public static function toRegex(string $gitignoreFileContent): string
2727
{
28-
$gitignoreFileContent = preg_replace('/^[^\\\\]*#.*/', '', $gitignoreFileContent);
28+
$gitignoreFileContent = preg_replace('/^[^\\\r\n]*#.*/m', '', $gitignoreFileContent);
2929
$gitignoreLines = preg_split('/\r\n|\r|\n/', $gitignoreFileContent);
3030
$gitignoreLines = array_map('trim', $gitignoreLines);
3131
$gitignoreLines = array_filter($gitignoreLines);

Tests/GitignoreTest.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,31 @@ public function provider(): array
107107
#IamComment
108108
/app/cache/',
109109
['app/cache/file.txt', 'app/cache/subdir/ile.txt'],
110-
['a/app/cache/file.txt'],
110+
['a/app/cache/file.txt', '#IamComment', 'IamComment'],
111+
],
112+
[
113+
'
114+
/app/cache/
115+
#LastLineIsComment',
116+
['app/cache/file.txt', 'app/cache/subdir/ile.txt'],
117+
['a/app/cache/file.txt', '#LastLineIsComment', 'LastLineIsComment'],
118+
],
119+
[
120+
'
121+
/app/cache/
122+
\#file.txt
123+
#LastLineIsComment',
124+
['app/cache/file.txt', 'app/cache/subdir/ile.txt', '#file.txt'],
125+
['a/app/cache/file.txt', '#LastLineIsComment', 'LastLineIsComment'],
126+
],
127+
[
128+
'
129+
/app/cache/
130+
\#file.txt
131+
#IamComment
132+
another_file.txt',
133+
['app/cache/file.txt', 'app/cache/subdir/ile.txt', '#file.txt', 'another_file.txt'],
134+
['a/app/cache/file.txt', 'IamComment', '#IamComment'],
111135
],
112136
];
113137
}

0 commit comments

Comments
 (0)