summaryrefslogtreecommitdiff
path: root/resolve-undo.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-04-01 01:49:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-14 20:47:45 (GMT)
commitdc26b23ebc30adcb4aa54a5eccf2e47793984fa2 (patch)
tree9a863a0ce957a5bf7d4ff0a8d636f0377091835f /resolve-undo.c
parent0c18c059a152058e30e23c4edcd24b3992599503 (diff)
downloadgit-dc26b23ebc30adcb4aa54a5eccf2e47793984fa2.zip
git-dc26b23ebc30adcb4aa54a5eccf2e47793984fa2.tar.gz
git-dc26b23ebc30adcb4aa54a5eccf2e47793984fa2.tar.bz2
resolve-undo: ensure full index
Before iterating over all cache entries, ensure that a sparse index is expanded to a full index to avoid unexpected behavior. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'resolve-undo.c')
-rw-r--r--resolve-undo.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/resolve-undo.c b/resolve-undo.c
index 236320f..ee36ca5 100644
--- a/resolve-undo.c
+++ b/resolve-undo.c
@@ -172,6 +172,8 @@ void unmerge_marked_index(struct index_state *istate)
if (!istate->resolve_undo)
return;
+ /* TODO: audit for interaction with sparse-index. */
+ ensure_full_index(istate);
for (i = 0; i < istate->cache_nr; i++) {
const struct cache_entry *ce = istate->cache[i];
if (ce->ce_flags & CE_MATCHED)
@@ -186,6 +188,8 @@ void unmerge_index(struct index_state *istate, const struct pathspec *pathspec)
if (!istate->resolve_undo)
return;
+ /* TODO: audit for interaction with sparse-index. */
+ ensure_full_index(istate);
for (i = 0; i < istate->cache_nr; i++) {
const struct cache_entry *ce = istate->cache[i];
if (!ce_path_match(istate, ce, pathspec, NULL))