Merge branch 'stable-3.0'
* stable-3.0: Upgrade buildifier to 0.22.0 ChangeQueryBuilder: Fix root directory case for Elasticsearch Change-Id: I7807f2d963802698f924e137079d1f69c7103027
This commit is contained in:
@@ -110,7 +110,7 @@ To format Java source code, Gerrit uses the
|
||||
link:https://github.com/google/google-java-format[`google-java-format`]
|
||||
tool (version 1.7), and to format Bazel BUILD, WORKSPACE and .bzl files the
|
||||
link:https://github.com/bazelbuild/buildtools/tree/master/buildifier[`buildifier`]
|
||||
tool (version 0.20.0).
|
||||
tool (version 0.22.0).
|
||||
These tools automatically apply format according to the style guides; this
|
||||
streamlines code review by reducing the need for time-consuming, tedious,
|
||||
and contentious discussions about trivial issues like whitespace.
|
||||
|
@@ -775,11 +775,20 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData, ChangeQueryBuil
|
||||
return new RegexDirectoryPredicate(directory);
|
||||
}
|
||||
|
||||
return new DirectoryPredicate(directory);
|
||||
DirectoryPredicate rootPredicate = new DirectoryPredicate(directory);
|
||||
if (isRootAndRecursive(directory)) {
|
||||
RegexDirectoryPredicate recursivePredicate = new RegexDirectoryPredicate("^.*");
|
||||
return Predicate.or(rootPredicate, recursivePredicate);
|
||||
}
|
||||
return rootPredicate;
|
||||
}
|
||||
throw new QueryParseException("'directory' operator is not supported by change index version");
|
||||
}
|
||||
|
||||
private static boolean isRootAndRecursive(String directory) {
|
||||
return directory.isEmpty() || directory.equals("/");
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> label(String name)
|
||||
throws QueryParseException, IOException, ConfigInvalidException {
|
||||
|
Reference in New Issue
Block a user