Browse Source

Use RawParseUtils.prevLF in RebaseCommand

As noticed by Robin Rosenberg in review of
I4eb87c850078ca187b38b81cc91c92afb1176945.

Change-Id: If96d66b6c025ad8f2f47829c933f3c65ab6cbeef
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-3.0
Robin Stocker 12 years ago committed by Matthias Sohn
parent
commit
44ea46dd40
  1. 6
      org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

6
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

@ -1250,10 +1250,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
throws IOException { throws IOException {
byte[] content = IO.readFully(new File(directory, fileName)); byte[] content = IO.readFully(new File(directory, fileName));
// strip off the last LF // strip off the last LF
int end = content.length; int end = RawParseUtils.prevLF(content, content.length);
while (0 < end && content[end - 1] == '\n') return RawParseUtils.decode(content, 0, end + 1);
end--;
return RawParseUtils.decode(content, 0, end);
} }
private static void createFile(File parentDir, String name, private static void createFile(File parentDir, String name,

Loading…
Cancel
Save