Skip to content

Commit e3ca715

Browse files
committed
Do not exclude ".gitignore" and ".cvsignore" by default (#326)
This closes #312
1 parent b16a390 commit e3ca715

5 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/main/java/org/codehaus/plexus/util/AbstractScanner.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public abstract class AbstractScanner implements Scanner {
2929
* Patterns which should be excluded by default, like SCM files
3030
* <ul>
3131
* <li>Misc: &#42;&#42;/&#42;~, &#42;&#42;/#&#42;#, &#42;&#42;/.#&#42;, &#42;&#42;/%&#42;%, &#42;&#42;/._&#42;</li>
32-
* <li>CVS: &#42;&#42;/CVS, &#42;&#42;/CVS/&#42;&#42;, &#42;&#42;/.cvsignore</li>
32+
* <li>CVS: &#42;&#42;/CVS, &#42;&#42;/CVS/&#42;&#42;</li>
3333
* <li>RCS: &#42;&#42;/RCS, &#42;&#42;/RCS/&#42;&#42;</li>
3434
* <li>SCCS: &#42;&#42;/SCCS, &#42;&#42;/SCCS/&#42;&#42;</li>
3535
* <li>VSSercer: &#42;&#42;/vssver.scc</li>
@@ -61,7 +61,6 @@ public abstract class AbstractScanner implements Scanner {
6161
// CVS
6262
"**/CVS",
6363
"**/CVS/**",
64-
"**/.cvsignore",
6564

6665
// RCS
6766
"**/RCS",

src/test/java/org/codehaus/plexus/util/DirectoryScannerTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,20 @@ void isParentSymbolicLink() throws Exception {
541541
ds.isParentSymbolicLink(new File(directory, "symLinkToDirOnTheOutside"), "FileInDirOnTheOutside.txt"));
542542
}
543543

544+
@Test
545+
void defaultExcludes() throws Exception {
546+
DirectoryScanner ds = new DirectoryScanner();
547+
// work in src directory as target has filtering already applied with outdated default excludes
548+
// (https://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#addDefaultExcludes)
549+
ds.setBasedir(new File("src/test/resources/directory-scanner-default-excludes").getCanonicalFile());
550+
551+
ds.addDefaultExcludes();
552+
ds.scan();
553+
554+
assertInclusionsAndExclusions(
555+
ds.getIncludedFiles(), new String[] {}, ".gitignore", ".gitattributes", ".cvsignore");
556+
}
557+
544558
private void printTestHeader() {
545559
StackTraceElement ste = new Throwable().getStackTrace()[1];
546560
System.out.println("Test: " + ste.getMethodName());
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# must not be excluded, otherwise the project will not work
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# must not be excluded
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# must not be excluded

0 commit comments

Comments
 (0)