Allow matching changes with files that have no extension by 'ext' operator

Files that have no extension can now be matched with the 'ext' search
operator by an empty string: ext:""

This makes the handling of files with no extension consistent between
the 'ext' and 'onlyexts' search operators.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I42774ce8641c429e6fc7aa55948769cc0a1fa48e
This commit is contained in:
Edwin Kempin
2019-01-29 12:15:37 +01:00
parent 0e88d5d69a
commit e8079ce597
4 changed files with 14 additions and 5 deletions

View File

@@ -1379,7 +1379,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
Change change1 = insert(repo, newChangeWithFiles(repo, "foo.h", "foo.cc"));
Change change2 = insert(repo, newChangeWithFiles(repo, "bar.H", "bar.CC"));
Change change3 = insert(repo, newChangeWithFiles(repo, "dir/baz.h", "dir/baz.cc"));
Change change4 = insert(repo, newChangeWithFiles(repo, "Quux.java"));
Change change4 = insert(repo, newChangeWithFiles(repo, "Quux.java", "foo"));
assertQuery("extension:java", change4);
assertQuery("ext:java", change4);
@@ -1387,6 +1387,12 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
assertQuery("ext:jAvA", change4);
assertQuery("ext:.jAvA", change4);
assertQuery("ext:cc", change3, change2, change1);
if (getSchemaVersion() >= 56) {
// matching changes with files that have no extension is possible
assertQuery("ext:\"\"", change4);
assertFailingQuery("ext:");
}
}
@Test