diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/ContainingBranchesGetter.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/ContainingBranchesGetter.java index 2c227a7235d6..e6b47f7c32c1 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/ContainingBranchesGetter.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/ContainingBranchesGetter.java @@ -134,11 +134,11 @@ public class ContainingBranchesGetter { PermanentGraph graph = dataPack.getPermanentGraph(); VcsLogRefs refs = dataPack.getRefsModel(); - VcsRef branchRef = ContainerUtil.find(refs.getBranches(), - vcsRef -> vcsRef.getRoot().equals(root) && vcsRef.getName().equals(branchName)); - if (branchRef == null) return Conditions.alwaysFalse(); ContainedInBranchCondition condition = myConditions.get(root); if (condition == null || !condition.getBranch().equals(branchName)) { + VcsRef branchRef = ContainerUtil.find(refs.getBranches(), + vcsRef -> vcsRef.getRoot().equals(root) && vcsRef.getName().equals(branchName)); + if (branchRef == null) return Conditions.alwaysFalse(); condition = new ContainedInBranchCondition(graph.getContainedInBranchCondition( Collections.singleton(myLogData.getCommitIndex(branchRef.getCommitHash(), branchRef.getRoot()))), branchName); myConditions.put(root, condition);