mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[git] git log provider recognizes "Regex" and "Match case" options in text filter
This commit is contained in:
@@ -444,16 +444,6 @@ public class GitLogProvider implements VcsLogProvider {
|
||||
filterParameters.addAll(GitHistoryUtils.LOG_ALL);
|
||||
}
|
||||
|
||||
if (filterCollection.getUserFilter() != null) {
|
||||
List<String> authors = ContainerUtil.map(filterCollection.getUserFilter().getUserNames(root), UserNameRegex.BASIC_INSTANCE);
|
||||
if (GitVersionSpecialty.LOG_AUTHOR_FILTER_SUPPORTS_VERTICAL_BAR.existsIn(myVcs.getVersion())) {
|
||||
filterParameters.add(prepareParameter("author", StringUtil.join(authors, "\\|")));
|
||||
}
|
||||
else {
|
||||
filterParameters.addAll(authors.stream().map(a -> prepareParameter("author", a)).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
|
||||
if (filterCollection.getDateFilter() != null) {
|
||||
// assuming there is only one date filter, until filter expressions are defined
|
||||
VcsLogDateFilter filter = filterCollection.getDateFilter();
|
||||
@@ -465,12 +455,35 @@ public class GitLogProvider implements VcsLogProvider {
|
||||
}
|
||||
}
|
||||
|
||||
boolean regexp = true;
|
||||
boolean caseSensitive = false;
|
||||
if (filterCollection.getTextFilter() != null) {
|
||||
regexp = filterCollection.getTextFilter().isRegex();
|
||||
caseSensitive = filterCollection.getTextFilter().matchesCase();
|
||||
String textFilter = filterCollection.getTextFilter().getText();
|
||||
filterParameters.add(prepareParameter("grep", StringUtil.escapeChars(textFilter, '[', ']')));
|
||||
filterParameters.add(prepareParameter("grep", textFilter));
|
||||
}
|
||||
filterParameters.add(regexp ? "--extended-regexp" : "--fixed-strings");
|
||||
if (!caseSensitive) {
|
||||
filterParameters.add("--regexp-ignore-case"); // affects case sensitivity of any filter (except file filter)
|
||||
}
|
||||
|
||||
if (filterCollection.getUserFilter() != null) {
|
||||
Collection<String> names = filterCollection.getUserFilter().getUserNames(root);
|
||||
if (regexp) {
|
||||
List<String> authors = ContainerUtil.map(names, UserNameRegex.EXTENDED_INSTANCE);
|
||||
if (GitVersionSpecialty.LOG_AUTHOR_FILTER_SUPPORTS_VERTICAL_BAR.existsIn(myVcs.getVersion())) {
|
||||
filterParameters.add(prepareParameter("author", StringUtil.join(authors, "|")));
|
||||
}
|
||||
else {
|
||||
filterParameters.addAll(authors.stream().map(a -> prepareParameter("author", a)).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
filterParameters.addAll(ContainerUtil.map(names, a -> prepareParameter("author", StringUtil.escapeBackSlashes(a))));
|
||||
}
|
||||
}
|
||||
|
||||
filterParameters.add("--regexp-ignore-case"); // affects case sensitivity of any filter (except file filter)
|
||||
if (maxCount > 0) {
|
||||
filterParameters.add(prepareParameter("max-count", String.valueOf(maxCount)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user