Merge pull request #1754 from njam/issue-1754
Fix file pattern start matching if no slashpull/1485/merge
commit
57c34033ff
|
@ -116,9 +116,9 @@ abstract class BaseExcludeFilter
|
||||||
/**
|
/**
|
||||||
* Generates an exclude pattern for filter() from a gitignore rule
|
* Generates an exclude pattern for filter() from a gitignore rule
|
||||||
*
|
*
|
||||||
* @param string An exclude rule in gitignore syntax
|
* @param string $rule An exclude rule in gitignore syntax
|
||||||
*
|
*
|
||||||
* @param array An exclude pattern
|
* @return array An exclude pattern
|
||||||
*/
|
*/
|
||||||
protected function generatePattern($rule)
|
protected function generatePattern($rule)
|
||||||
{
|
{
|
||||||
|
@ -133,6 +133,8 @@ abstract class BaseExcludeFilter
|
||||||
if (strlen($rule) && $rule[0] === '/') {
|
if (strlen($rule) && $rule[0] === '/') {
|
||||||
$pattern .= '^/';
|
$pattern .= '^/';
|
||||||
$rule = substr($rule, 1);
|
$rule = substr($rule, 1);
|
||||||
|
} elseif (false === strpos($rule, '/') || strlen($rule) - 1 === strpos($rule, '/')) {
|
||||||
|
$pattern .= '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
$pattern .= substr(Finder\Glob::toRegex($rule), 2, -2);
|
$pattern .= substr(Finder\Glob::toRegex($rule), 2, -2);
|
||||||
|
|
|
@ -113,6 +113,7 @@ class ArchivableFilesFinderTest extends \PHPUnit_Framework_TestCase
|
||||||
'prefixF.*',
|
'prefixF.*',
|
||||||
'!/*/*/prefixF.foo',
|
'!/*/*/prefixF.foo',
|
||||||
'',
|
'',
|
||||||
|
'refixD.foo',
|
||||||
)));
|
)));
|
||||||
|
|
||||||
// git does not currently support negative git attributes
|
// git does not currently support negative git attributes
|
||||||
|
|
Loading…
Reference in New Issue