Fix file name matching in commit_delta to perform substring matching
commit_delta predicate was matching the entire file name against the
given regex while other predicates (commit_edits, commit_message_matches)
performed substring matching. It was inconsistent that for commit_delta we
needed to write something like:
commit_delta('.*\.java')
to match all *.java files, while for commit_edits we needed:
commit_edits('\.java$', '...').
to match the same set of (Java) files.
Change-Id: Ib3360684d570539522bfad7b8df2d99734e7157e
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
diff --git a/gerrit-server/src/main/java/gerrit/PRED_commit_delta_4.java b/gerrit-server/src/main/java/gerrit/PRED_commit_delta_4.java
index c2c2d1c..045297b 100644
--- a/gerrit-server/src/main/java/gerrit/PRED_commit_delta_4.java
+++ b/gerrit-server/src/main/java/gerrit/PRED_commit_delta_4.java
@@ -110,8 +110,8 @@
continue;
}
- if (regex.matcher(newName).matches() ||
- (oldName != null && regex.matcher(oldName).matches())) {
+ if (regex.matcher(newName).find() ||
+ (oldName != null && regex.matcher(oldName).find())) {
SymbolTerm changeSym = getTypeSymbol(changeType);
SymbolTerm newSym = SymbolTerm.create(newName);
SymbolTerm oldSym = Prolog.Nil;