Fix lockup of '/COMMIT_MSG' file from patch set
For some changes Gerrit is wrongly showing "No differences" as diff for the commit message. If this happens the reviewers are unable to comment on the commit message. The files in the patch set are lexicographically sorted, but the commit message is always the first entry. Accessing a file from the patch set by name assumes that all files in the patch set are lexicographically sorted. This is normally true since the file for the commit message '/COMMIT_MSG' comes because of its leading '/' lexicographically before most other files. However there are files which come lexicographically even before '/', e.g. all files starting with '.', like '.gitignore'. If such a file is contained in the patch set accessing the commit message file from the patch set fails. As result Gerrit thinks that the commit message does not exist and shows the "No Differences" message on the patch screen. This change fixes the lookup of the commit message file from the patch set. If the commit message file is requested, simply the first file from the patch set is returned as we know that the first entry is always the commit message file. Change-Id: I7168b3152ef63586e9ee68cd6abcdc9f77787444 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com> Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
This commit is contained in:

committed by
Sasa Zivkov

parent
4f44b633a1
commit
97dd91e2a1
@@ -142,8 +142,12 @@ public class PatchList implements Serializable {
|
||||
}
|
||||
|
||||
private int search(final String fileName) {
|
||||
if (Patch.COMMIT_MSG.equals(fileName)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int high = patches.length;
|
||||
int low = 0;
|
||||
int low = 1;
|
||||
while (low < high) {
|
||||
final int mid = (low + high) >>> 1;
|
||||
final int cmp = patches[mid].getNewName().compareTo(fileName);
|
||||
|
Reference in New Issue
Block a user