Skip to content

Commit d41e48d

Browse files
committed
fill repository properties from project before building tag list
1 parent 694602c commit d41e48d

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/RepositoryFactory.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ public static Repository getRepository(File file, CommandTimeoutType cmdType, bo
215215
});
216216
}
217217

218-
if (repo.getType() == null || repo.getType().length() == 0) {
218+
if (repo.getType() == null || repo.getType().isEmpty()) {
219219
repo.setType(repo.getClass().getSimpleName());
220220
}
221221

222-
if (repo.getParent() == null || repo.getParent().length() == 0) {
222+
if (repo.getParent() == null || repo.getParent().isEmpty()) {
223223
try {
224224
repo.setParent(repo.determineParent(cmdType));
225225
} catch (IOException ex) {
@@ -229,7 +229,7 @@ public static Repository getRepository(File file, CommandTimeoutType cmdType, bo
229229
}
230230
}
231231

232-
if (repo.getBranch() == null || repo.getBranch().length() == 0) {
232+
if (repo.getBranch() == null || repo.getBranch().isEmpty()) {
233233
try {
234234
repo.setBranch(repo.determineBranch(cmdType));
235235
} catch (IOException ex) {
@@ -239,7 +239,7 @@ public static Repository getRepository(File file, CommandTimeoutType cmdType, bo
239239
}
240240
}
241241

242-
if (repo.getCurrentVersion() == null || repo.getCurrentVersion().length() == 0) {
242+
if (repo.getCurrentVersion() == null || repo.getCurrentVersion().isEmpty()) {
243243
try {
244244
repo.setCurrentVersion(repo.determineCurrentVersion(cmdType));
245245
} catch (IOException ex) {
@@ -249,14 +249,16 @@ public static Repository getRepository(File file, CommandTimeoutType cmdType, bo
249249
}
250250
}
251251

252+
// This has to be called before building tag list below as it depends on the repository properties
253+
// inherited from the project/configuration.
254+
repo.fillFromProject();
255+
252256
// If this repository displays tags only for files changed by tagged
253257
// revision, we need to prepare list of all tags in advance.
254258
if (cmdType.equals(CommandTimeoutType.INDEXER) && repo.isTagsEnabled() && repo.hasFileBasedTags()) {
255259
repo.buildTagList(file, cmdType);
256260
}
257261

258-
repo.fillFromProject();
259-
260262
break;
261263
}
262264
}

opengrok-indexer/src/test/java/org/opengrok/indexer/history/FileHistoryCacheTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ void testStoreAndGetNotRenamed() throws Exception {
241241

242242
/**
243243
* Test tagging by creating history cache for repository with one tag and
244-
* then importing couple of changesets which add both file changes and tags.
244+
* then importing a couple of changesets which add both file changes and tags.
245245
* The last history entry before the import is important as it needs to be
246-
* retagged when old history is merged with the new one.
246+
* re-tagged when old history is merged with the new one.
247247
*/
248248
@EnabledForRepository(MERCURIAL)
249249
@Test

0 commit comments

Comments
 (0)