Inline edit: Strip trailing blank lines from commit messages
Trim the input commit message to prevent trailing blank lines. If blank lines are present, it causes problems when the commit is merged and then cherry-picked with the -x option (from the command line). Trim it both on the client and on the server. If we do it only on the client, it will still be possible to update the commit message with trailing blank lines by a direct call to the REST API. Bug: Issue 3616 Change-Id: I1a3df4668d7ba6f395c5e782e2962652ead577d8
This commit is contained in:
@@ -453,6 +453,13 @@ public class EditScreen extends Screen {
|
||||
if (!cm.isClean(generation)) {
|
||||
close.setEnabled(false);
|
||||
String text = cm.getValue();
|
||||
if (Patch.COMMIT_MSG.equals(path)) {
|
||||
String trimmed = text.trim() + "\r";
|
||||
if (!trimmed.equals(text)) {
|
||||
text = trimmed;
|
||||
cm.setValue(text);
|
||||
}
|
||||
}
|
||||
final int g = cm.changeGeneration(false);
|
||||
ChangeEditApi.put(revision.getParentKey().get(), path, text,
|
||||
new GerritCallback<VoidResult>() {
|
||||
|
||||
Reference in New Issue
Block a user