Skip to content

Commit f0bb589

Browse files
committed
ignore path actions which match top-level directory of the repository in Subversion history parser
fixes #694
1 parent 8827962 commit f0bb589

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/org/opensolaris/opengrok/history/FileHistoryCache.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ public void store(History history, Repository repository)
230230
* hash map entry for the file) in a file.
231231
*/
232232
File root = RuntimeEnvironment.getInstance().getSourceRootFile();
233-
for (Map.Entry<String, List<HistoryEntry>> e : map.entrySet()) {
233+
for (Map.Entry<String, List<HistoryEntry>> map_entry : map.entrySet()) {
234234
History hist = null;
235235

236236
/*
237237
* We do not want to generate history cache for files which
238238
* do not currently exist in the repository.
239239
*/
240-
File test = new File(env.getSourceRootPath() + e.getKey());
240+
File test = new File(env.getSourceRootPath() + map_entry.getKey());
241241
if (!test.exists()) {
242242
continue;
243243
}
@@ -248,7 +248,7 @@ public void store(History history, Repository repository)
248248
* This ensures that their complete history (follow) will be
249249
* saved.
250250
*/
251-
String fullfile = e.getKey();
251+
String fullfile = map_entry.getKey();
252252
try {
253253
String repodir = env.getPathRelativeToSourceRoot(
254254
new File(repository.getDirectoryName()), 0);
@@ -264,11 +264,11 @@ public void store(History history, Repository repository)
264264
if (hist == null) {
265265
hist = new History();
266266

267-
for (HistoryEntry ent : e.getValue()) {
267+
for (HistoryEntry ent : map_entry.getValue()) {
268268
ent.strip();
269269
}
270270
// add all history entries
271-
hist.setHistoryEntries(e.getValue());
271+
hist.setHistoryEntries(map_entry.getValue());
272272
} else {
273273
for (HistoryEntry ent : hist.getHistoryEntries()) {
274274
ent.strip();
@@ -280,7 +280,7 @@ public void store(History history, Repository repository)
280280
repository.assignTagsInHistory(hist);
281281
}
282282

283-
File file = new File(root, e.getKey());
283+
File file = new File(root, map_entry.getKey());
284284
if (!file.isDirectory()) {
285285
storeFile(hist, file);
286286
}

src/org/opensolaris/opengrok/history/SubversionHistoryParser.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ public void endElement(String uri, String localName, String qname) {
9494
OpenGrokLogger.getLogger().log(Level.SEVERE, "Failed to parse: " + s, ex);
9595
}
9696
} else if ("path".equals(qname)) {
97-
if (s.startsWith(prefix)) {
97+
/*
98+
* We only want valid files in the repository, not the
99+
* top-level directory itself, hence the check for inequivality.
100+
*/
101+
if (s.startsWith(prefix) && !s.equals(prefix)) {
98102
File file = new File(home, s.substring(prefix.length()));
99103
String path = file.getAbsolutePath().substring(length);
100104
// The same file names may be repeated in many commits,

0 commit comments

Comments
 (0)