FileOutputStream fos = new FileOutputStream(file);
try {
fos.write(content.getBytes("UTF-8"));
+ fos.write('\n');
} finally {
fos.close();
}
}
private String readFile(File directory, String fileName) throws IOException {
- return RawParseUtils
- .decode(IO.readFully(new File(directory, fileName)));
+ 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);
}
private void checkoutCommit(RevCommit commit) throws IOException {