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>
stable-4.7
Andrey Loskutov 8 years ago
parent
commit
a4b9c73391
  1. 8
      org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

8
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();
}

Loading…
Cancel
Save