summaryrefslogtreecommitdiffstats
path: root/resolve-undo.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-08-01 00:44:03 +0200
committerJunio C Hamano <gitster@pobox.com>2023-08-01 00:46:17 +0200
commit91e07058c5663d01d39a00418c91415d0227d53c (patch)
tree86d0e4674e96a7673c98a5b669f53795804fb1ce /resolve-undo.h
parentMerge branch 'jk/redact-h2h3-headers-fix' into maint-2.41 (diff)
downloadgit-91e07058c5663d01d39a00418c91415d0227d53c.tar.xz
git-91e07058c5663d01d39a00418c91415d0227d53c.zip
update-index: do not read HEAD and MERGE_HEAD unconditionally
When "update-index --unresolve $path" cannot find the resolve-undo record for the path the user requested to unresolve, it stuffs the blobs from HEAD and MERGE_HEAD to stage #2 and stage #3 as a fallback. For this reason, the operation does not even start unless both "HEAD" and "MERGE_HEAD" exist. This is suboptimal in a few ways: * It does not recreate stage #1. Even though it is a correct design decision not to do so (because it is impossible to recreate in general cases, without knowing how we got there, including what merge strategy was used), it is much less useful not to have that information in the index. * It limits the "unresolve" operation only during a conflicted "git merge" and nothing else. Other operations like "rebase", "cherry-pick", and "switch -m" may result in conflicts, and the user may want to unresolve the conflict that they incorrectly resolved in order to redo the resolution, but the fallback would not kick in. * Most importantly, the entire "unresolve" operation is disabled after a conflicted merge is committed and MERGE_HEAD is removed, even though the index has perfectly usable resolve-undo records. By lazily reading the HEAD and MERGE_HEAD only when we need to go to the fallback codepath, we will allow cases where resolve-undo records are available (which is 100% of the time, unless the user is reading from an index file created by Git more than 10 years ago) to proceed even after a conflicted merge was committed, during other mergy operations that do not use MERGE_HEAD, or after the result of such mergy operations has been committed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'resolve-undo.h')
0 files changed, 0 insertions, 0 deletions