summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-06-30 17:12:16 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2018-11-05 15:53:03 +0000
commitdddfff77a49c5cf83d01ec66b09acbf80ef33a13 (patch)
treec2d0c2d90d595a7e1b9182d27e3ca2db063abb4f
parent9db66c790d04ee81e838160d2c60c6193daef82f (diff)
downloadlibgit2-dddfff77a49c5cf83d01ec66b09acbf80ef33a13.tar.gz
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.
-rw-r--r--src/apply.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/apply.c b/src/apply.c
index fd1d5335a..1a20278c3 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;