18
18
*/
19
19
20
20
/*
21
- * Copyright (c) 2008, 2021 , Oracle and/or its affiliates. All rights reserved.
21
+ * Copyright (c) 2008, 2022 , Oracle and/or its affiliates. All rights reserved.
22
22
* Portions Copyright (c) 2019, 2020, Chris Fraire <[email protected] >.
23
23
*/
24
24
package org .opengrok .indexer .history ;
@@ -107,7 +107,7 @@ public void tearDown() {
107
107
}
108
108
109
109
@ Test
110
- public void testGetRevision () throws HistoryException , IOException {
110
+ void testGetRevision () throws HistoryException , IOException {
111
111
HistoryGuru instance = HistoryGuru .getInstance ();
112
112
113
113
for (File f : FILES ) {
@@ -127,7 +127,7 @@ public void testGetRevision() throws HistoryException, IOException {
127
127
128
128
@ Test
129
129
@ EnabledForRepository (SUBVERSION )
130
- public void testBug16465 () throws HistoryException , IOException {
130
+ void testBug16465 () throws HistoryException , IOException {
131
131
HistoryGuru instance = HistoryGuru .getInstance ();
132
132
for (File f : FILES ) {
133
133
if (f .getName ().equals ("bugreport16465@" )) {
@@ -138,7 +138,7 @@ public void testBug16465() throws HistoryException, IOException {
138
138
}
139
139
140
140
@ Test
141
- public void annotation () throws Exception {
141
+ void annotation () throws Exception {
142
142
HistoryGuru instance = HistoryGuru .getInstance ();
143
143
for (File f : FILES ) {
144
144
if (instance .hasAnnotation (f )) {
@@ -148,14 +148,14 @@ public void annotation() throws Exception {
148
148
}
149
149
150
150
@ Test
151
- public void getCacheInfo () throws HistoryException {
151
+ void getCacheInfo () throws HistoryException {
152
152
// FileHistoryCache is used by default
153
153
assertEquals ("FileHistoryCache" ,
154
154
HistoryGuru .getInstance ().getCacheInfo ());
155
155
}
156
156
157
157
@ Test
158
- public void testAddRemoveRepositories () {
158
+ void testAddRemoveRepositories () {
159
159
HistoryGuru instance = HistoryGuru .getInstance ();
160
160
final int numReposOrig = instance .getRepositories ().size ();
161
161
@@ -180,7 +180,7 @@ public void testAddRemoveRepositories() {
180
180
181
181
@ Test
182
182
@ EnabledForRepository (CVS )
183
- public void testAddSubRepositoryNotNestable () {
183
+ void testAddSubRepositoryNotNestable () {
184
184
HistoryGuru instance = HistoryGuru .getInstance ();
185
185
186
186
// Check out CVS underneath a Git repository.
@@ -201,7 +201,7 @@ public void testAddSubRepositoryNotNestable() {
201
201
202
202
@ Test
203
203
@ EnabledForRepository (MERCURIAL )
204
- public void testAddSubRepository () {
204
+ void testAddSubRepository () {
205
205
HistoryGuru instance = HistoryGuru .getInstance ();
206
206
207
207
// Clone a Mercurial repository underneath a Mercurial repository.
@@ -218,7 +218,7 @@ public void testAddSubRepository() {
218
218
}
219
219
220
220
@ Test
221
- public void testNestingMaximum () throws IOException {
221
+ void testNestingMaximum () throws IOException {
222
222
// Just fake a nesting of Repo -> Git -> Git.
223
223
File repoRoot = new File (repository .getSourceRoot (), "repoRoot" );
224
224
certainlyMkdirs (repoRoot );
@@ -253,7 +253,7 @@ private static void certainlyMkdirs(File file) throws IOException {
253
253
}
254
254
255
255
@ Test
256
- public void testScanningDepth () throws IOException {
256
+ void testScanningDepth () throws IOException {
257
257
String topLevelDirName = "scanDepthTest" ;
258
258
File repoRoot = new File (repository .getSourceRoot (), topLevelDirName );
259
259
certainlyMkdirs (repoRoot );
@@ -293,7 +293,7 @@ void testGetLastHistoryEntryNonexistent() throws HistoryException {
293
293
294
294
@ ParameterizedTest
295
295
@ ValueSource (booleans = {true , false })
296
- void testGetLastHistoryEntry (boolean isIndexerParam ) throws HistoryException {
296
+ void testGetLastHistoryEntryVsIndexer (boolean isIndexerParam ) throws HistoryException {
297
297
boolean isIndexer = env .isIndexer ();
298
298
env .setIndexer (isIndexerParam );
299
299
boolean isTagsEnabled = env .isTagsEnabled ();
@@ -309,4 +309,16 @@ void testGetLastHistoryEntry(boolean isIndexerParam) throws HistoryException {
309
309
env .setIndexer (isIndexer );
310
310
env .setTagsEnabled (isTagsEnabled );
311
311
}
312
+
313
+ @ Test
314
+ void testGetLastHistoryEntryRepoHistoryDisabled () throws HistoryException {
315
+ File file = new File (repository .getSourceRoot (), "git" );
316
+ assertTrue (file .exists ());
317
+ HistoryGuru instance = HistoryGuru .getInstance ();
318
+ Repository repository = instance .getRepository (file );
319
+ assertNotNull (repository );
320
+ repository .setHistoryEnabled (false );
321
+ assertNull (instance .getLastHistoryEntry (file , false ));
322
+ repository .setHistoryEnabled (true );
323
+ }
312
324
}
0 commit comments