File tree Expand file tree Collapse file tree 4 files changed +19
-32
lines changed
opengrok-indexer/src/main/java/org/opengrok/indexer/index Expand file tree Collapse file tree 4 files changed +19
-32
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ public class Filter implements Serializable {
46
46
* The full list of all patterns. This list will be saved in the
47
47
* configuration file (if used).
48
48
*/
49
- private final List < String > items ;
49
+ private final PatternList items ;
50
50
51
51
public Filter () {
52
52
filenames = new HashSet <>();
@@ -154,7 +154,7 @@ public boolean match(File file) {
154
154
* @return true if this pathname matches, false otherwise
155
155
*/
156
156
public boolean match (String name ) {
157
- /**
157
+ /*
158
158
* Creating File object out of relative path would mean the path would be
159
159
* checked against current working directory which is usually undesired.
160
160
*/
Original file line number Diff line number Diff line change 19
19
20
20
/*
21
21
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
22
+ * Portions Copyright (c) 2019, Chris Fraire <[email protected] >.
22
23
*/
23
24
package org .opengrok .indexer .index ;
24
25
@@ -45,21 +46,14 @@ public IgnoredDirs() {
45
46
}
46
47
47
48
/**
48
- * Should the file be ignored or not?
49
- * @param file the file to check
50
- * @return true if this file should be ignored, false otherwise
49
+ * Should the file (that must be a directory) be ignored or not?
50
+ * @return {@code true} if {@code file} has
51
+ * {@link File#isDirectory()} () == true} and should be ignored per
52
+ * filtering
51
53
*/
52
- public boolean ignore (File file ) {
53
- return file .isDirectory () && match (file );
54
- }
55
-
56
- /**
57
- * Should the file be ignored or not?
58
- * @param name the name of the file to check
59
- * @return true if this pathname should be ignored, false otherwise
60
- */
61
- public boolean ignore (String name ) {
62
- return match (name );
54
+ @ Override
55
+ public boolean match (File file ) {
56
+ return file .isDirectory () && super .match (file );
63
57
}
64
58
65
59
private void addDefaultPatterns () {
Original file line number Diff line number Diff line change 19
19
20
20
/*
21
21
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
22
+ * Portions Copyright (c) 2019, Chris Fraire <[email protected] >.
22
23
*/
23
24
package org .opengrok .indexer .index ;
24
25
@@ -67,20 +68,12 @@ public IgnoredFiles() {
67
68
68
69
/**
69
70
* Should the file be ignored or not?
70
- * @param file the file to check
71
- * @return true if this file should be ignored, false otherwise
71
+ * @return {@code true} if {@code file} has {@link File#isFile() == true}
72
+ * and should be ignored per filtering
72
73
*/
73
- public boolean ignore (File file ) {
74
- return file .isFile () && match (file );
75
- }
76
-
77
- /**
78
- * Should the file be ignored or not?
79
- * @param name the name of the file to check
80
- * @return true if this pathname should be ignored, false otherwise
81
- */
82
- public boolean ignore (String name ) {
83
- return match (name );
74
+ @ Override
75
+ public boolean match (File file ) {
76
+ return file .isFile () && super .match (file );
84
77
}
85
78
86
79
private void addDefaultPatterns () {
Original file line number Diff line number Diff line change @@ -79,9 +79,9 @@ public void add(String pattern) {
79
79
*/
80
80
public boolean ignore (File file ) {
81
81
if (file .isFile ()) {
82
- return ignoredFiles .ignore (file );
82
+ return ignoredFiles .match (file );
83
83
} else {
84
- return ignoredDirs .ignore (file );
84
+ return ignoredDirs .match (file );
85
85
}
86
86
}
87
87
@@ -92,7 +92,7 @@ public boolean ignore(File file) {
92
92
* @return true if this pathname should be ignored, false otherwise
93
93
*/
94
94
public boolean ignore (String name ) {
95
- return ignoredFiles .ignore (name ) || ignoredDirs .ignore (name );
95
+ return ignoredFiles .match (name ) || ignoredDirs .match (name );
96
96
}
97
97
98
98
public void clear () {
You can’t perform that action at this time.
0 commit comments