diff --git a/plugins/git4idea/src/git4idea/ui/branch/GitMultiRootBranchConfig.java b/plugins/git4idea/src/git4idea/ui/branch/GitMultiRootBranchConfig.java index 4d5c1ee94cc1..bc39ea6133de 100644 --- a/plugins/git4idea/src/git4idea/ui/branch/GitMultiRootBranchConfig.java +++ b/plugins/git4idea/src/git4idea/ui/branch/GitMultiRootBranchConfig.java @@ -152,19 +152,20 @@ public class GitMultiRootBranchConfig { @NotNull private Collection getCommonBranches(boolean local) { - Collection commonLocal = null; + Collection commonBranches = null; for (GitRepository repository : myRepositories) { GitBranchesCollection branchesCollection = repository.getBranches(); Collection branches = local ? branchesCollection.getLocalBranches() : branchesCollection.getRemoteBranches(); - if (commonLocal == null) { - commonLocal = GitUtil.getBranchNames(branches); - } else { - commonLocal.retainAll(GitUtil.getBranchNames(branches)); + if (commonBranches == null) { + commonBranches = GitUtil.getBranchNames(branches); + } + else { + commonBranches.retainAll(GitUtil.getBranchNames(branches)); } } - if (commonLocal != null) { - ArrayList common = new ArrayList(commonLocal); + if (commonBranches != null) { + ArrayList common = new ArrayList(commonBranches); Collections.sort(common); return common; }