Fix detection of deleted files

The path /dev/null must not be prefixed with a or b.
This commit is contained in:
René Pfeuffer
2020-11-17 09:26:03 +01:00
parent a8c30a2422
commit e222363dcd

View File

@@ -596,14 +596,22 @@ public class SCMSvnDiffGenerator implements ISvnDiffGenerator {
String path1 = operation == SvnDiffCallback.OperationKind.Added ? "/dev/null" : getRelativeToRootPath(target, originalTarget1);
String path2 = operation == SvnDiffCallback.OperationKind.Deleted ? "/dev/null" : getRelativeToRootPath(target, originalTarget2);
try {
displayString(outputStream, String.format("--- a/%s\n", path1));
displayString(outputStream, String.format("+++ b/%s\n", path2));
displayString(outputStream, formatPath(path1, "---", "a"));
displayString(outputStream, formatPath(path2, "+++", "b"));
displayString(outputStream, "Binary files differ");
} catch (IOException e) {
wrapException(e);
}
}
private String formatPath(String path, String start, String aOrB) {
if (path.equals("/dev/null")) {
return String.format("%s %s\n", start, path);
} else {
return String.format("%s %s/%s\n", start, aOrB, path);
}
}
private void displayBinary(String mimeType1, String mimeType2, OutputStream outputStream, boolean leftIsBinary, boolean rightIsBinary) throws SVNException {
displayCannotDisplayFileMarkedBinary(outputStream);