From fa025e8718e5f6d1b6c2e82e9368d6931d376d4c Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Mon, 30 Jan 2017 22:34:44 +0300 Subject: [PATCH] [file-history] return unmodified visible graph if can not find current row --- .../vcs/log/ui/history/FileHistoryFilterer.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/history/FileHistoryFilterer.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/history/FileHistoryFilterer.java index 967e33776cff..6b827cfbbac7 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/history/FileHistoryFilterer.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/history/FileHistoryFilterer.java @@ -80,11 +80,12 @@ class FileHistoryFilterer extends VcsLogFilterer { if (visibleGraph instanceof VisibleGraphImpl) { int row = getCurrentRow(dataPack, visibleGraph, namesData); - - FileHistoryRefiner refiner = new FileHistoryRefiner(visibleGraph, namesData); - if (refiner.refine(((VisibleGraphImpl)visibleGraph).getLinearGraph(), row, myFilePath)) { - // creating a vg is the most expensive task, so trying to avoid that when unnecessary - visibleGraph = createVisibleGraph(dataPack, sortType, matchingHeads, refiner.getMatchingCommits()); + if (row >= 0) { + FileHistoryRefiner refiner = new FileHistoryRefiner(visibleGraph, namesData); + if (refiner.refine(((VisibleGraphImpl)visibleGraph).getLinearGraph(), row, myFilePath)) { + // creating a vg is the most expensive task, so trying to avoid that when unnecessary + visibleGraph = createVisibleGraph(dataPack, sortType, matchingHeads, refiner.getMatchingCommits()); + } } } } @@ -105,7 +106,7 @@ class FileHistoryFilterer extends VcsLogFilterer { return findAncestorRowAffectingFile((PermanentGraphImpl)permanentGraph, head.getCommitHash(), visibleGraph, fileIndexData); } } - return 0; + return -1; } private int findAncestorRowAffectingFile(@NotNull PermanentGraphImpl permanentGraph, @@ -131,7 +132,7 @@ class FileHistoryFilterer extends VcsLogFilterer { return ObjectUtils.assertNotNull(rowIndex); } - return 0; + return -1; } private static class FileHistoryRefiner implements DfsUtil.NodeVisitor {