Do not perform character translation on copies in patches
Translation is unnecessary and risks damaging the file. Also ensure that we close the file if an I/O error occurs. Change-Id: Ieae6eb941fdeaa61f2611f4cd14dd39117aa12f9
This commit is contained in:
parent
c310fa0c80
commit
92893d1f92
|
@ -43,6 +43,7 @@
|
||||||
package org.eclipse.jgit.api;
|
package org.eclipse.jgit.api;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -147,10 +148,14 @@ public ApplyResult call() throws GitAPIException, PatchFormatException,
|
||||||
case COPY:
|
case COPY:
|
||||||
f = getFile(fh.getOldPath(), false);
|
f = getFile(fh.getOldPath(), false);
|
||||||
byte[] bs = IO.readFully(f);
|
byte[] bs = IO.readFully(f);
|
||||||
FileWriter fw = new FileWriter(getFile(fh.getNewPath(),
|
FileOutputStream fos = new FileOutputStream(getFile(
|
||||||
|
fh.getNewPath(),
|
||||||
true));
|
true));
|
||||||
fw.write(new String(bs));
|
try {
|
||||||
fw.close();
|
fos.write(bs);
|
||||||
|
} finally {
|
||||||
|
fos.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
r.addUpdatedFile(f);
|
r.addUpdatedFile(f);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue