diff options
author | Andrey Loskutov <loskutov@gmx.de> | 2017-03-15 20:29:21 +0100 |
---|---|---|
committer | Andrey Loskutov <loskutov@gmx.de> | 2017-03-15 20:29:21 +0100 |
commit | a4b9c73391d75b6069908ce67e4414f30105c947 (patch) | |
tree | 6f101d7ddf47ac30476d9e9a0ae34ed79429e5ab /org.eclipse.jgit/src | |
parent | ca4223f2ce17462fd64fbaf949287fb83c244673 (diff) | |
download | jgit-a4b9c73391d75b6069908ce67e4414f30105c947.tar.gz jgit-a4b9c73391d75b6069908ce67e4414f30105c947.zip |
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>
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java index f704492fe5..850ff49695 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -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(); } |