Browse Source

Don't try to strip new line if the message buffer is empty

Bug: 513726
Change-Id: I0e7c19f8883b93bad1b9de166f671d28f3e9c240
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
tags/v4.7.0.201704051617-r
Andrey Loskutov 7 years ago
parent
commit
a4b9c73391
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

+ 6
- 2
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java View File

@@ -806,8 +806,12 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
if (!line.trim().startsWith("#")) //$NON-NLS-1$
result.append(line).append("\n"); //$NON-NLS-1$
}
if (!commitMessage.endsWith("\n")) //$NON-NLS-1$
result.deleteCharAt(result.length() - 1);
if (!commitMessage.endsWith("\n")) { //$NON-NLS-1$
int bufferSize = result.length();
if (bufferSize > 0 && result.charAt(bufferSize - 1) == '\n') {
result.deleteCharAt(bufferSize - 1);
}
}
return result.toString();
}


Loading…
Cancel
Save