From 43c81ef35d9b0bc2a5a954e5c8bc38c614986de4 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Tue, 15 Nov 2016 00:29:26 +0300 Subject: [PATCH] [git] fix deep comparator keeping highlighting after branch filter unset When branch filter is unset, cherri-picked commits should be un-highlighted. But when this happen during refresh, visible pack arrives with both new graph and new filters. So DeepComparator should check filters first. --- .../src/git4idea/branch/DeepComparator.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/plugins/git4idea/src/git4idea/branch/DeepComparator.java b/plugins/git4idea/src/git4idea/branch/DeepComparator.java index 7aed03546ce8..4cd1d3bc7689 100644 --- a/plugins/git4idea/src/git4idea/branch/DeepComparator.java +++ b/plugins/git4idea/src/git4idea/branch/DeepComparator.java @@ -139,9 +139,14 @@ public class DeepComparator implements VcsLogHighlighter, Disposable { return; } + String comparedBranch = myTask.myComparedBranch; + VcsLogBranchFilter branchFilter = dataPack.getFilters().getBranchFilter(); + if (branchFilter == null || !myTask.myComparedBranch.equals(VcsLogUtil.getSingleFilteredBranch(branchFilter, dataPack.getRefs()))) { + stopAndUnhighlight(); + return; + } + if (refreshHappened) { - // collect data - String comparedBranch = myTask.myComparedBranch; Map repositoriesWithCurrentBranches = myTask.myRepositoriesWithCurrentBranches; VcsLogDataProvider provider = myTask.myProvider; @@ -149,14 +154,12 @@ public class DeepComparator implements VcsLogHighlighter, Disposable { // highlight again Map repositories = getRepositories(dataPack.getLogProviders(), comparedBranch); - if (repositories.equals(repositoriesWithCurrentBranches)) { // but not if current branch changed + if (repositories.equals(repositoriesWithCurrentBranches)) { + // but not if current branch changed highlightInBackground(comparedBranch, provider); } - } - else { - VcsLogBranchFilter branchFilter = dataPack.getFilters().getBranchFilter(); - if (branchFilter == null || !myTask.myComparedBranch.equals(VcsLogUtil.getSingleFilteredBranch(branchFilter, dataPack.getRefs()))) { - stopAndUnhighlight(); + else { + removeHighlighting(); } } } @@ -278,6 +281,5 @@ public class DeepComparator implements VcsLogHighlighter, Disposable { handler.runInCurrentThread(null); return pickedCommits; } - } } \ No newline at end of file