Don't expose /COMMIT_MSG as a modified file in ChangeData
We don't want uses to pattern match "file:^/COMMIT_MSG", because
every single change contains it.
Change-Id: Ib47af2ad97950d7a3f7326d743a9b01fb11866d4
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/mail/CommentSender.java b/gerrit-server/src/main/java/com/google/gerrit/server/mail/CommentSender.java
index fb7f32a..b5e9259 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/mail/CommentSender.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/mail/CommentSender.java
@@ -50,7 +50,9 @@
Set<String> paths = new HashSet<String>();
for (PatchLineComment c : plc) {
Patch.Key p = c.getKey().getParentKey();
- paths.add(p.getFileName());
+ if (!Patch.COMMIT_MSG.equals(p.getFileName())) {
+ paths.add(p.getFileName());
+ }
}
changeData.setCurrentFilePaths(paths);
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java
index dfeac0c..d5bf1e0 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/query/change/ChangeData.java
@@ -15,6 +15,7 @@
package com.google.gerrit.server.query.change;
import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.reviewdb.Patch;
import com.google.gerrit.reviewdb.PatchLineComment;
import com.google.gerrit.reviewdb.PatchSet;
import com.google.gerrit.reviewdb.PatchSetApproval;
@@ -71,6 +72,9 @@
PatchList p = cache.get(c, ps);
List<String> r = new ArrayList<String>(p.getPatches().size());
for (PatchListEntry e : p.getPatches()) {
+ if (Patch.COMMIT_MSG.equals(e.getNewName())) {
+ continue;
+ }
switch (e.getChangeType()) {
case ADDED:
case MODIFIED: