apply: when preimage file is missing, return EAPPLYFAIL The preimage file being missing entirely is simply a case of an application failure; return the correct error value for the caller.
diff --git a/src/apply.c b/src/apply.c
index 95c4fcb..fd1d533 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -409,8 +409,14 @@ static int apply_one(
if (delta->status != GIT_DELTA_ADDED) {
if ((error = git_reader_read(&pre_contents,
- preimage_reader, delta->old_file.path)) < 0)
+ preimage_reader, delta->old_file.path)) < 0) {
+
+ /* ENOTFOUND is really an application error */
+ if (error == GIT_ENOTFOUND)
+ error = GIT_EAPPLYFAIL;
+
goto done;
+ }
}
if ((error = git_apply__patch(&post_contents, &filename, &mode,