Skip to content

Commit 5aba820

Browse files
authored
Merge pull request #2077 from idodeclare/bugfix/badpath
Properly handle result of getRelativeToCanonical()
2 parents 4a85a26 + a877aeb commit 5aba820

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,10 +855,15 @@ protected Repository getRepository(File path) {
855855
e);
856856
return null;
857857
}
858-
String inRootPath = Paths.get(rootKey, rel).toString();
859-
Repository r = repositories.get(inRootPath);
860-
if (r != null) {
861-
return r;
858+
Repository repo;
859+
if (rel.equals(nextPath)) {
860+
repo = repositories.get(nextPath);
861+
} else {
862+
String inRootPath = Paths.get(rootKey, rel).toString();
863+
repo = repositories.get(inRootPath);
864+
}
865+
if (repo != null) {
866+
return repo;
862867
}
863868
}
864869

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/*
2121
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
22-
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>.
22+
* Portions Copyright (c) 2017-2018, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opensolaris.opengrok.history;
2525

@@ -131,7 +131,9 @@ public void setDirectoryName(File dir) {
131131
// `directoryNameRelative' must start with a '/', as it is
132132
// elsewhere directly appended to env.getSourceRootPath() and
133133
// also stored as such.
134-
if (!path.equals(originalPath)) path = File.separator + path;
134+
if (!path.equals(originalPath)) {
135+
path = File.separator + path;
136+
}
135137
} catch (IOException e) {
136138
path = originalPath;
137139
LOGGER.log(Level.SEVERE, String.format(

0 commit comments

Comments
 (0)