1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Get rid of gitignore/hgignore handling (fixes #7358), Add support for -export-ignore (fixes #9153)

This commit is contained in:
Jordi Boggiano 2021-11-24 22:44:03 +01:00
parent cc3b53bc2e
commit 126f95a8d7
No known key found for this signature in database
GPG key ID: 7BBD42C429EC80BC
6 changed files with 30 additions and 242 deletions

View file

@ -156,40 +156,33 @@ class ArchivableFilesFinderTest extends TestCase
{
$this->skipIfNotExecutable('git');
file_put_contents($this->sources.'/.gitignore', implode("\n", array(
'# gitignore rules with comments and blank lines',
'',
'prefixE.foo',
'# and more',
'# comments',
'',
'!/prefixE.foo',
'/prefixD.foo',
'prefixF.*',
'!/*/*/prefixF.foo',
'',
'refixD.foo',
'/C',
'D/prefixA',
'E',
'F/',
'G/*',
'H/**',
'J/',
'parameters.yml',
'\!important!.txt',
'\#*',
)));
// git does not currently support negative git attributes
file_put_contents($this->sources.'/.gitattributes', implode("\n", array(
'',
'# gitattributes rules with comments and blank lines',
'prefixB.foo export-ignore',
//'!/prefixB.foo export-ignore',
'/prefixA.foo export-ignore',
'prefixC.* export-ignore',
//'!/*/*/prefixC.foo export-ignore',
'',
'prefixE.foo export-ignore',
'# and more',
'# comments',
'',
'/prefixE.foo -export-ignore',
'/prefixD.foo export-ignore',
'prefixF.* export-ignore',
'/*/*/prefixF.foo -export-ignore',
'',
'refixD.foo export-ignore',
'/C export-ignore',
'D/prefixA export-ignore',
'E export-ignore',
'F/ export-ignore',
'G/* export-ignore',
'H/** export-ignore',
'J/ export-ignore',
'parameters.yml export-ignore',
'\!important!.txt export-ignore',
'\#* export-ignore',
)));
$this->finder = new ArchivableFilesFinder($this->sources, array());
@ -207,46 +200,6 @@ class ArchivableFilesFinderTest extends TestCase
));
}
public function testHgExcludes()
{
$this->skipIfNotExecutable('hg');
file_put_contents($this->sources.'/.hgignore', implode("\n", array(
'# hgignore rules with comments, blank lines and syntax changes',
'',
'pre*A.foo',
'prefixE.foo',
'# and more',
'# comments',
'',
'^prefixD.foo',
'D/prefixA',
'parameters.yml',
'\!important!.txt',
'E',
'F/',
'syntax: glob',
'prefixF.*',
'B/*',
'H/**',
)));
$this->finder = new ArchivableFilesFinder($this->sources, array());
$expectedFiles = $this->getArchivedFiles(
'hg init && '.
'hg add && '.
'hg commit -m "init" && '.
'hg archive archive.zip'
);
// Remove .hg_archival.txt from the expectedFiles
$archiveKey = array_search('/.hg_archival.txt', $expectedFiles);
array_splice($expectedFiles, $archiveKey, 1);
$this->assertArchivableFiles($expectedFiles);
}
public function testSkipExcludes()
{
$excludes = array(