Skip to content

Commit e90537a

Browse files
cnstLubos Kosco
authored andcommitted
ignore paths, not just filenames; fixes issue #38
1 parent eb82bbb commit e90537a

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/org/opensolaris/opengrok/index/Filter.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public boolean match(File file) {
108108
boolean ret = false;
109109

110110
String fileName = file.getName();
111+
String absolute = file.getAbsolutePath();
111112

112113
if (filename.contains(fileName)) {
113114
ret = true;
@@ -118,11 +119,17 @@ public boolean match(File file) {
118119
ret = true;
119120
break;
120121
}
122+
if (p.pattern().contains("/")) {
123+
m = p.matcher(absolute);
124+
if (m.matches()) {
125+
ret = true;
126+
break;
127+
}
128+
}
121129
}
122130
}
123131

124132
if (!ret) {
125-
String absolute = file.getAbsolutePath();
126133
for (String s : path) {
127134
if (absolute.endsWith(s)) {
128135
ret = true;

src/org/opensolaris/opengrok/web/DirectoryListing.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ public List<String> listTo(File dir, Writer out, String path, List<String> files
143143
continue;
144144
}
145145
File child = new File(dir, file);
146+
if (ignoredNames.ignore(child)) {
147+
continue;
148+
}
146149
if (file.startsWith("README") || file.endsWith("README")
147150
|| file.startsWith("readme"))
148151
{

src/org/opensolaris/opengrok/web/PageConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,8 @@ public String getResourcePath() {
972972
public boolean resourceNotAvailable() {
973973
getIgnoredNames();
974974
return getResourcePath().equals("/") || ignoredNames.ignore(getPath())
975-
|| ignoredNames.ignore(resourceFile.getParentFile().getName());
975+
|| ignoredNames.ignore(resourceFile.getParentFile().getName())
976+
|| ignoredNames.ignore(resourceFile);
976977
}
977978

978979
/**

0 commit comments

Comments
 (0)