]> source.dussan.org Git - jgit.git/commitdiff
Use RawParseUtils.prevLF in RebaseCommand 22/11022/2
authorRobin Stocker <robin@nibor.org>
Sat, 9 Mar 2013 15:35:14 +0000 (16:35 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Sat, 16 Mar 2013 22:32:29 +0000 (23:32 +0100)
As noticed by Robin Rosenberg in review of
I4eb87c850078ca187b38b81cc91c92afb1176945.

Change-Id: If96d66b6c025ad8f2f47829c933f3c65ab6cbeef
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

index a206a3bc21e557923c7c6baf5f830e34509557a8..911a4e6294810b9f4b19aa9322b3c5298014925c 100644 (file)
@@ -1250,10 +1250,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
                                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,