summaryrefslogtreecommitdiff
path: root/resolve-undo.c
diff options
context:
space:
mode:
Diffstat (limited to 'resolve-undo.c')
-rw-r--r--resolve-undo.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/resolve-undo.c b/resolve-undo.c
index 236320f179..e81096e2d4 100644
--- a/resolve-undo.c
+++ b/resolve-undo.c
@@ -15,7 +15,7 @@ void record_resolve_undo(struct index_state *istate, struct cache_entry *ce)
return;
if (!istate->resolve_undo) {
- resolve_undo = xcalloc(1, sizeof(*resolve_undo));
+ CALLOC_ARRAY(resolve_undo, 1);
resolve_undo->strdup_strings = 1;
istate->resolve_undo = resolve_undo;
}
@@ -57,7 +57,7 @@ struct string_list *resolve_undo_read(const char *data, unsigned long size)
int i;
const unsigned rawsz = the_hash_algo->rawsz;
- resolve_undo = xcalloc(1, sizeof(*resolve_undo));
+ CALLOC_ARRAY(resolve_undo, 1);
resolve_undo->strdup_strings = 1;
while (size) {
@@ -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))