Instead of subclassing PrintWriter to override the println() method we can replace the one println() call we do make with print('\n'), which ensures we only produce an LF and never a CRLF file. Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> --- .../src/org/spearce/jgit/lib/Config.java | 4 ++-- .../src/org/spearce/jgit/lib/FileBasedConfig.java | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Config.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Config.java index a2934a2..8eb2e2a 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/Config.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Config.java @@ -677,7 +677,7 @@ private int findSectionEnd(final String section, final String subsection) { * Print configuration file to the PrintWriter * * @param r - * the print writer (it must use '\n' as new line separator). + * stream to write the configuration to. */ protected void printConfig(final PrintWriter r) { final Iterator<Entry> i = entries.iterator(); @@ -714,7 +714,7 @@ protected void printConfig(final PrintWriter r) { if (e.suffix != null) { r.print(e.suffix); } - r.println(); + r.print('\n'); } } diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/FileBasedConfig.java b/org.spearce.jgit/src/org/spearce/jgit/lib/FileBasedConfig.java index 75e88f6..aa1dbee 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/FileBasedConfig.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/FileBasedConfig.java @@ -80,12 +80,7 @@ public void save() throws IOException { + ".lock"); final PrintWriter r = new PrintWriter(new BufferedWriter( new OutputStreamWriter(new FileOutputStream(tmp), - Constants.CHARSET))) { - @Override - public void println() { - print('\n'); - } - }; + Constants.CHARSET))); boolean ok = false; try { printConfig(r); -- 1.6.4.rc1.186.g60aa0c -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html