From 7e8b160547e475da05cac95e8566d59e62a33112 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Mon, 25 Nov 2013 19:15:51 +0400 Subject: [PATCH] [log] IDEA-116399 Fix filter by branch --branches parameter doesn't work well: the pattern syntax it supports is rather weak, and won't allow to effectively filter by several branches. It also doesn't support filtering by a single branch without blog parameters. Therefore, since we allow to filter only by a single branch in the log UI, assume it in the GitLogProvider, and use the parameter (`git log origin/master`), which works fine. If we will provide ability to filter by several branches someday (by AND or by OR), we could use the graph capabilities to implement it. --- .../git4idea/src/git4idea/log/GitLogProvider.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/git4idea/src/git4idea/log/GitLogProvider.java b/plugins/git4idea/src/git4idea/log/GitLogProvider.java index c25903541fad..04d967902834 100644 --- a/plugins/git4idea/src/git4idea/log/GitLogProvider.java +++ b/plugins/git4idea/src/git4idea/log/GitLogProvider.java @@ -179,13 +179,13 @@ public class GitLogProvider implements VcsLogProvider { List branchFilters = ContainerUtil.findAll(filters, VcsLogBranchFilter.class); if (!branchFilters.isEmpty()) { - String branchFilter = joinFilters(branchFilters, new Function() { - @Override - public String fun(VcsLogBranchFilter filter) { - return filter.getBranchName(); - } - }); - filterParameters.add(prepareParameter("branches", branchFilter)); + // git doesn't support filtering by several branches very well (--branches parameter give a weak pattern capabilities) + // => by now assuming there is only one branch filter. + if (branchFilters.size() > 1) { + LOG.warn("More than one branch filter was passed. Using only the first one."); + } + VcsLogBranchFilter branchFilter = branchFilters.get(0); + filterParameters.add(branchFilter.getBranchName()); } else { filterParameters.add("--all");