aboutsummaryrefslogtreecommitdiff
path: root/apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-04-15 13:36:01 -0700
committerJunio C Hamano <gitster@pobox.com>2021-04-15 13:36:01 -0700
commit5a7e52bed263c1dbc181ece54b73ee4318e79fca (patch)
treedf12b136643c70bbdd24bc0676efb064649ee760 /apply.c
parentb98db1dd7002f52f3b61b7487dde7043e740ad8a (diff)
parentc0c2a37ac2b9338c3a93340cbcbab69690da4df0 (diff)
downloadgit-5a7e52bed263c1dbc181ece54b73ee4318e79fca.tar.xz
Merge branch 'jz/apply-3way-cached'
"git apply" now takes "--3way" and "--cached" at the same time, and work and record results only in the index. * jz/apply-3way-cached: git-apply: allow simultaneous --cached and --3way options
Diffstat (limited to 'apply.c')
-rw-r--r--apply.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/apply.c b/apply.c
index 69197268cc..8c5b29809b 100644
--- a/apply.c
+++ b/apply.c
@@ -134,8 +134,6 @@ int check_apply_state(struct apply_state *state, int force_apply)
if (state->apply_with_reject && state->threeway)
return error(_("--reject and --3way cannot be used together."));
- if (state->cached && state->threeway)
- return error(_("--cached and --3way cannot be used together."));
if (state->threeway) {
if (is_not_gitdir)
return error(_("--3way outside a repository"));
@@ -4646,7 +4644,12 @@ static int write_out_results(struct apply_state *state, struct patch *list)
}
string_list_clear(&cpath, 0);
- repo_rerere(state->repo, 0);
+ /*
+ * rerere relies on the partially merged result being in the working
+ * tree with conflict markers, but that isn't written with --cached.
+ */
+ if (!state->cached)
+ repo_rerere(state->repo, 0);
}
return errs;