public ApplyResult call() throws GitAPIException, PatchFormatException,
PatchApplyException {
checkCallable();
ApplyResult r = new ApplyResult();
try {
final Patch p = new Patch();
try {
p.parse(in);
} finally {
in.close();
}
if (!p.getErrors().isEmpty())
throw new PatchFormatException(p.getErrors());
for (FileHeader fh : p.getFiles()) {
ChangeType type = fh.getChangeType();
File f = null;
switch (type) {
case ADD:
f = getFile(fh.getNewPath(), true);