diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogPersistentIndex.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogPersistentIndex.java index 2d42057221c3..6ffa2c34ab5f 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogPersistentIndex.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/index/VcsLogPersistentIndex.java @@ -500,13 +500,13 @@ public class VcsLogPersistentIndex implements VcsLogIndex, Disposable { indicator.checkCanceled(); } catch (ProcessCanceledException reThrown) { + taskCompleted(null); throw reThrown; } catch (Throwable t) { LOG.error("Error while indexing", t); } } - taskCompleted(null); } }; @@ -555,10 +555,13 @@ public class VcsLogPersistentIndex implements VcsLogIndex, Disposable { indexOneByOne(commits, counter); } } + catch (ProcessCanceledException e) { + scheduleReindex(); + throw e; + } catch (VcsException e) { LOG.error(e); - commits.forEach(value -> markForIndexing(value, myRoot)); - scheduleIndex(false); + scheduleReindex(); } } finally { @@ -580,6 +583,15 @@ public class VcsLogPersistentIndex implements VcsLogIndex, Disposable { } } + private void scheduleReindex() { + LOG.debug("Schedule reindexing of " + myCommits.size() + " commits in " + myRoot.getName()); + myCommits.forEach(value -> { + markForIndexing(value, myRoot); + return true; + }); + scheduleIndex(false); + } + private void indexOneByOne(@NotNull IntStream commits, @NotNull CommitsCounter counter) throws VcsException { // We pass hashes to VcsLogProvider#readFullDetails in batches // in order to avoid allocating too much memory for these hashes