summaryrefslogtreecommitdiff
path: root/src/apply.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/apply.c')
-rw-r--r--src/apply.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/apply.c b/src/apply.c
index 04242621a..65b057c60 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -845,13 +845,17 @@ int git_apply(
(error = git_reader_for_index(&post_reader, repo, postimage)) < 0)
goto done;
- if ((error = git_repository_index(&index, repo)) < 0 ||
- (error = git_indexwriter_init(&indexwriter, index)) < 0)
- goto done;
+ if (!(opts.flags & GIT_APPLY_CHECK))
+ if ((error = git_repository_index(&index, repo)) < 0 ||
+ (error = git_indexwriter_init(&indexwriter, index)) < 0)
+ goto done;
if ((error = apply_deltas(repo, pre_reader, preimage, post_reader, postimage, diff, &opts)) < 0)
goto done;
+ if ((opts.flags & GIT_APPLY_CHECK))
+ goto done;
+
switch (location) {
case GIT_APPLY_LOCATION_BOTH:
error = git_apply__to_workdir(repo, diff, preimage, postimage, location, &opts);