apply: convert checkout conflicts to apply failures When there's a checkout conflict during apply, that means that the working directory was modified in a conflicting manner and the postimage cannot be written. During application, convert this to an application failure for consistency across workdir/index/both applications.
diff --git a/src/apply.c b/src/apply.c
index fd1d533..1a20278 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -539,6 +539,13 @@ static int git_apply__to_workdir(
error = git_checkout_index(repo, postimage, &checkout_opts);
+ /*
+ * When there's a checkout conflict, the file in the working directory
+ * has been modified. Upgrade this error to an application error.
+ */
+ if (error == GIT_ECONFLICT)
+ error = GIT_EAPPLYFAIL;
+
done:
git_vector_free(&paths);
return error;