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 a206a3bc2..911a4e629 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -1250,10 +1250,8 @@ public class RebaseCommand extends GitCommand { throws IOException { byte[] content = IO.readFully(new File(directory, fileName)); // strip off the last LF - int end = content.length; - while (0 < end && content[end - 1] == '\n') - end--; - return RawParseUtils.decode(content, 0, end); + int end = RawParseUtils.prevLF(content, content.length); + return RawParseUtils.decode(content, 0, end + 1); } private static void createFile(File parentDir, String name,