Skip to content

Commit 6d2c4db

Browse files
committed
Do not exclude ".gitignore" and ".cvsignore" by default
This closes #312
1 parent 975350e commit 6d2c4db

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

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

Lines changed: 2 additions & 4 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>
@@ -41,7 +41,7 @@ public abstract class AbstractScanner implements Scanner {
4141
* <li>Mac: &#42;&#42;/.DS_Store</li>
4242
* <li>Serena Dimension: &#42;&#42;/.metadata, &#42;&#42;/.metadata/&#42;&#42;</li>
4343
* <li>Mercurial: &#42;&#42;/.hg, &#42;&#42;/.hg/&#42;&#42;</li>
44-
* <li>Git: &#42;&#42;/.git, &#42;&#42;/.git/&#42;&#42;, &#42;&#42;/.gitignore</li>
44+
* <li>Git: &#42;&#42;/.git, &#42;&#42;/.git/&#42;&#42;</li>
4545
* <li>Bitkeeper: &#42;&#42;/BitKeeper, &#42;&#42;/BitKeeper/&#42;&#42;, &#42;&#42;/ChangeSet,
4646
* &#42;&#42;/ChangeSet/&#42;&#42;</li>
4747
* <li>Darcs: &#42;&#42;/_darcs, &#42;&#42;/_darcs/&#42;&#42;, &#42;&#42;/.darcsrepo,
@@ -61,7 +61,6 @@ public abstract class AbstractScanner implements Scanner {
6161
// CVS
6262
"**/CVS",
6363
"**/CVS/**",
64-
"**/.cvsignore",
6564

6665
// RCS
6766
"**/RCS",
@@ -106,7 +105,6 @@ public abstract class AbstractScanner implements Scanner {
106105
// git
107106
"**/.git",
108107
"**/.git/**",
109-
"**/.gitignore",
110108

111109
// BitKeeper
112110
"**/BitKeeper",

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,19 @@ void isParentSymbolicLink() throws Exception {
536536
ds.isParentSymbolicLink(new File(directory, "symLinkToDirOnTheOutside"), "FileInDirOnTheOutside.txt"));
537537
}
538538

539+
@Test
540+
void defaultExcludes() throws Exception {
541+
DirectoryScanner ds = new DirectoryScanner();
542+
// work in src directory as target has filtering already applied with outdated default excludes (https://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#addDefaultExcludes)
543+
ds.setBasedir(new File("src/test/resources/directory-scanner-default-excludes")
544+
.getCanonicalFile());
545+
546+
ds.addDefaultExcludes();
547+
ds.scan();
548+
549+
assertInclusionsAndExclusions(ds.getIncludedFiles(), new String[] {}, ".gitignore", ".gitattributes", ".cvsignore");
550+
}
551+
539552
private void printTestHeader() {
540553
StackTraceElement ste = new Throwable().getStackTrace()[1];
541554
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)