54
54
import java .util .logging .Logger ;
55
55
import java .util .zip .GZIPInputStream ;
56
56
import java .util .zip .GZIPOutputStream ;
57
- import org .opensolaris .opengrok .configuration .Project ;
58
57
import org .opensolaris .opengrok .configuration .RuntimeEnvironment ;
59
58
import org .opensolaris .opengrok .logger .LoggerFactory ;
60
59
import org .opensolaris .opengrok .util .ForbiddenSymlinkException ;
@@ -69,8 +68,8 @@ class FileHistoryCache implements HistoryCache {
69
68
70
69
private final Object lock = new Object ();
71
70
72
- private final static String historyCacheDirName = "historycache" ;
73
- private final static String latestRevFileName = "OpenGroklatestRev" ;
71
+ private final static String HISTORY_CACHE_DIR_NAME = "historycache" ;
72
+ private final static String LATEST_REV_FILE_NAME = "OpenGroklatestRev" ;
74
73
private final static String DIRECTORY_FILE_PREFIX = "OpenGrokDirHist" ;
75
74
76
75
private boolean historyIndexDone = false ;
@@ -201,7 +200,7 @@ private static File getCachedFile(File file) throws HistoryException,
201
200
StringBuilder sb = new StringBuilder ();
202
201
sb .append (env .getDataRootPath ());
203
202
sb .append (File .separatorChar );
204
- sb .append (historyCacheDirName );
203
+ sb .append (HISTORY_CACHE_DIR_NAME );
205
204
206
205
try {
207
206
String add = env .getPathRelativeToSourceRoot (file );
@@ -589,7 +588,8 @@ public History get(File file, Repository repository, boolean withFiles)
589
588
* fetched in the first phase of indexing.
590
589
*/
591
590
RuntimeEnvironment env = RuntimeEnvironment .getInstance ();
592
- if (isHistoryIndexDone () && repository .hasHistoryForDirectories () &&
591
+ if (isHistoryIndexDone () && repository .isHistoryEnabled () &&
592
+ repository .hasHistoryForDirectories () &&
593
593
!env .isFetchHistoryWhenNotInCache ()) {
594
594
return null ;
595
595
}
@@ -651,7 +651,7 @@ public boolean hasCacheForDirectory(File directory, Repository repository)
651
651
}
652
652
RuntimeEnvironment env = RuntimeEnvironment .getInstance ();
653
653
File dir = env .getDataRootFile ();
654
- dir = new File (dir , FileHistoryCache .historyCacheDirName );
654
+ dir = new File (dir , FileHistoryCache .HISTORY_CACHE_DIR_NAME );
655
655
try {
656
656
dir = new File (dir , env .getPathRelativeToSourceRoot (
657
657
new File (repos .getDirectoryName ())));
@@ -692,14 +692,14 @@ public String getRepositoryHistDataDirname(Repository repository) {
692
692
}
693
693
694
694
return env .getDataRootPath () + File .separatorChar
695
- + FileHistoryCache .historyCacheDirName
695
+ + FileHistoryCache .HISTORY_CACHE_DIR_NAME
696
696
+ repoDirBasename ;
697
697
}
698
698
699
699
private String getRepositoryCachedRevPath (Repository repository ) {
700
700
String histDir = getRepositoryHistDataDirname (repository );
701
701
if (histDir == null ) return null ;
702
- return histDir + File .separatorChar + latestRevFileName ;
702
+ return histDir + File .separatorChar + LATEST_REV_FILE_NAME ;
703
703
}
704
704
705
705
/**
0 commit comments