@@ -68,6 +68,8 @@ public final class HistoryGuru {
6868 */
6969 private static final HistoryGuru INSTANCE = new HistoryGuru ();
7070
71+ private final RuntimeEnvironment env ;
72+
7173 /**
7274 * The history cache to use.
7375 */
@@ -91,10 +93,10 @@ public final class HistoryGuru {
9193 * control system.
9294 */
9395 private HistoryGuru () {
94- HistoryCache cache = null ;
95- RuntimeEnvironment env = RuntimeEnvironment .getInstance ();
96+ env = RuntimeEnvironment .getInstance ();
9697 scanningDepth = env .getScanningDepth ();
9798
99+ HistoryCache cache = null ;
98100 if (env .useHistoryCache ()) {
99101 cache = new FileHistoryCache ();
100102
@@ -244,7 +246,7 @@ public History getHistory(File file, boolean withFiles, boolean ui)
244246 final File dir = file .isDirectory () ? file : file .getParentFile ();
245247 final Repository repo = getRepository (dir );
246248
247- RemoteSCM rscm = RuntimeEnvironment . getInstance () .getRemoteScmSupported ();
249+ RemoteSCM rscm = env .getRemoteScmSupported ();
248250 boolean doRemote = (ui && (rscm == RemoteSCM .UIONLY ))
249251 || (rscm == RemoteSCM .ON )
250252 || (ui || ((rscm == RemoteSCM .DIRBASED ) && (repo != null ) && repo .hasHistoryForDirectories ()));
@@ -318,9 +320,9 @@ public boolean hasHistory(File file) {
318320
319321 // This should return true for Annotate view.
320322 return repo .isWorking () && repo .fileHasHistory (file )
321- && ((RuntimeEnvironment . getInstance () .getRemoteScmSupported () == RemoteSCM .ON )
322- || (RuntimeEnvironment . getInstance () .getRemoteScmSupported () == RemoteSCM .UIONLY )
323- || (RuntimeEnvironment . getInstance () .getRemoteScmSupported () == RemoteSCM .DIRBASED )
323+ && ((env .getRemoteScmSupported () == RemoteSCM .ON )
324+ || (env .getRemoteScmSupported () == RemoteSCM .UIONLY )
325+ || (env .getRemoteScmSupported () == RemoteSCM .DIRBASED )
324326 || !repo .isRemote ());
325327 }
326328
@@ -541,8 +543,7 @@ private void createCache(Repository repository, String sinceRevision) {
541543
542544 private void createCacheReal (Collection <Repository > repositories ) {
543545 Statistics elapsed = new Statistics ();
544- ExecutorService executor = RuntimeEnvironment .getInstance ().
545- getIndexerParallelizer ().getHistoryExecutor ();
546+ ExecutorService executor = env .getIndexerParallelizer ().getHistoryExecutor ();
546547 // Since we know each repository object from the repositories
547548 // collection is unique, we can abuse HashMap to create a list of
548549 // repository,revision tuples with repository as key (as the revision
@@ -704,7 +705,7 @@ public void createCache() {
704705 */
705706 private List <Repository > getReposFromString (Collection <String > repositories ) {
706707 ArrayList <Repository > repos = new ArrayList <>();
707- File srcRoot = RuntimeEnvironment . getInstance () .getSourceRootFile ();
708+ File srcRoot = env .getSourceRootFile ();
708709
709710 for (String file : repositories ) {
710711 File f = new File (srcRoot , file );
0 commit comments