Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2005-04-21 13:53:43 +0000
committerMichael Valenta2005-04-21 13:53:43 +0000
commit9a19a9617852ac68a899ebaedb856ae10334f5b3 (patch)
tree3a5944d70d96eec7f892253f7d773e11797a54d6 /bundles/org.eclipse.team.cvs.core
parentf0b7b5ad1a2c09c73157688464a0221db3c21b98 (diff)
downloadeclipse.platform.team-9a19a9617852ac68a899ebaedb856ae10334f5b3.tar.gz
eclipse.platform.team-9a19a9617852ac68a899ebaedb856ae10334f5b3.tar.xz
eclipse.platform.team-9a19a9617852ac68a899ebaedb856ae10334f5b3.zip
Bug 92162 "create patch" makes patches incompatible patches on linux
Diffstat (limited to 'bundles/org.eclipse.team.cvs.core')
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java9
2 files changed, 7 insertions, 4 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
index 776d5d16c..ecb4591ab 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
@@ -58,7 +58,7 @@ public class Session {
// no incremental progress shown for files smaller than this size
private static final int TRANSFER_PROGRESS_INCREMENT = 32768;
- private static final boolean IS_CRLF_PLATFORM = Arrays.equals(
+ public static final boolean IS_CRLF_PLATFORM = Arrays.equals(
System.getProperty("line.separator").getBytes(), new byte[] { '\r', '\n' }); //$NON-NLS-1$
private CVSRepositoryLocation location;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java
index aa6131706..643a8ad7a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.client.CommandOutputListener;
+import org.eclipse.team.internal.ccvs.core.client.Session;
public class DiffListener extends CommandOutputListener {
PrintStream patchStream;
@@ -32,9 +33,11 @@ public class DiffListener extends CommandOutputListener {
ICVSFolder commandRoot,
IProgressMonitor monitor) {
- // Ensure that the line doesn't end with a CR.
- // This can happen if the remote file has CR/LF in it.
- if (line.length() > 0 && line.charAt(line.length() - 1) == '\r') {
+ // Special handling to avoid getting duplicate CRs when generating a patch on windows.
+ // If the remote file has CR/LF in it, then the line will have a CR at the end.
+ // We need to remove it so we don't end up with two CRs (since the printStream will also add one).
+ // On *nix, we want to include the CR since it will not be added by the printStream (see bug 92162).
+ if (Session.IS_CRLF_PLATFORM && line.length() > 0 && line.charAt(line.length() - 1) == '\r') {
line = line.substring(0, line.length() - 1);
}
patchStream.println(line);

Back to the top