diff --git a/builtin/commit.c b/builtin/commit.c index da296192b46f95..5ca91dcecb7ac4 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -385,7 +385,7 @@ static int list_paths(struct string_list *list, const char *with_tree, } /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(the_repository->index); + ensure_full_index_unaudited(the_repository->index); for (i = 0; i < the_repository->index->cache_nr; i++) { const struct cache_entry *ce = the_repository->index->cache[i]; struct string_list_item *item; @@ -1133,7 +1133,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix, int i, ita_nr = 0; /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(the_repository->index); + ensure_full_index_unaudited(the_repository->index); for (i = 0; i < the_repository->index->cache_nr; i++) if (ce_intent_to_add(the_repository->index->cache[i])) ita_nr++; diff --git a/builtin/difftool.c b/builtin/difftool.c index fbd7537b1be769..fc5811c43eb57e 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -592,7 +592,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix, ret = run_command(&cmd); /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(&wtindex); + ensure_full_index_unaudited(&wtindex); /* * If the diff includes working copy files and those diff --git a/builtin/fsck.c b/builtin/fsck.c index 0196c54eb68ee5..e86176f6a75c1b 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -821,7 +821,7 @@ static void fsck_index(struct index_state *istate, const char *index_path, unsigned int i; /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(istate); + ensure_full_index_unaudited(istate); for (i = 0; i < istate->cache_nr; i++) { unsigned int mode; struct blob *blob; diff --git a/builtin/merge-index.c b/builtin/merge-index.c index 342699edb77c97..6a1d7966626692 100644 --- a/builtin/merge-index.c +++ b/builtin/merge-index.c @@ -66,7 +66,7 @@ static void merge_all(void) { int i; /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(the_repository->index); + ensure_full_index_unaudited(the_repository->index); for (i = 0; i < the_repository->index->cache_nr; i++) { const struct cache_entry *ce = the_repository->index->cache[i]; if (!ce_stage(ce)) @@ -93,7 +93,7 @@ int cmd_merge_index(int argc, repo_read_index(the_repository); /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(the_repository->index); + ensure_full_index_unaudited(the_repository->index); i = 1; if (!strcmp(argv[i], "-o")) { diff --git a/builtin/stash.c b/builtin/stash.c index dbaa999cf171a7..2e2e40823b77f9 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -1560,7 +1560,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q char *ps_matched = xcalloc(ps->nr, 1); /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(the_repository->index); + ensure_full_index_unaudited(the_repository->index); for (size_t i = 0; i < the_repository->index->cache_nr; i++) ce_path_match(the_repository->index, the_repository->index->cache[i], ps, ps_matched); diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index f9b970f8a64a54..5a708639452993 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -3400,7 +3400,7 @@ static void die_on_index_match(const char *path, int force) char *ps_matched = xcalloc(ps.nr, 1); /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(the_repository->index); + ensure_full_index_unaudited(the_repository->index); /* * Since there is only one pathspec, we just need to diff --git a/entry.c b/entry.c index 358379a94cf6ec..ac5eff43e8493f 100644 --- a/entry.c +++ b/entry.c @@ -453,7 +453,7 @@ static void mark_colliding_entries(const struct checkout *state, ce->ce_flags |= CE_MATCHED; /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(state->istate); + ensure_full_index_unaudited(state->istate); for (size_t i = 0; i < state->istate->cache_nr; i++) { struct cache_entry *dup = state->istate->cache[i]; diff --git a/merge-recursive.c b/merge-recursive.c index ed87ce52b95cd1..cc10b1c6f86af8 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -540,7 +540,7 @@ static struct string_list *get_unmerged(struct index_state *istate) string_list_init_dup(unmerged); /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(istate); + ensure_full_index_unaudited(istate); for (i = 0; i < istate->cache_nr; i++) { struct string_list_item *item; struct stage_data *e; diff --git a/read-cache.c b/read-cache.c index 647d5423b1ec24..70cbfc55cd5bf2 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2590,7 +2590,7 @@ int repo_index_has_changes(struct repository *repo, return opt.flags.has_changes != 0; } else { /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(istate); + ensure_full_index_unaudited(istate); for (i = 0; sb && i < istate->cache_nr; i++) { if (i) strbuf_addch(sb, ' '); @@ -3872,7 +3872,7 @@ void overlay_tree_on_index(struct index_state *istate, /* Hoist the unmerged entries up to stage #3 to make room */ /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(istate); + ensure_full_index_unaudited(istate); for (i = 0; i < istate->cache_nr; i++) { struct cache_entry *ce = istate->cache[i]; if (!ce_stage(ce)) diff --git a/resolve-undo.c b/resolve-undo.c index b5a9dfb4acc511..6f148a89e396e3 100644 --- a/resolve-undo.c +++ b/resolve-undo.c @@ -161,7 +161,7 @@ void unmerge_index(struct index_state *istate, const struct pathspec *pathspec, return; /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(istate); + ensure_full_index_unaudited(istate); for_each_string_list_item(item, istate->resolve_undo) { const char *path = item->string; diff --git a/revision.c b/revision.c index 32d949b36feb80..7a2e32eb27aa90 100644 --- a/revision.c +++ b/revision.c @@ -1850,7 +1850,7 @@ static void do_add_index_objects_to_pending(struct rev_info *revs, int i; /* TODO: audit for interaction with sparse-index. */ - ensure_full_index(istate); + ensure_full_index_unaudited(istate); for (i = 0; i < istate->cache_nr; i++) { struct cache_entry *ce = istate->cache[i]; struct blob *blob; diff --git a/sparse-index.h b/sparse-index.h index 09a8701476c7ff..15180b02ea6599 100644 --- a/sparse-index.h +++ b/sparse-index.h @@ -1,6 +1,8 @@ #ifndef SPARSE_INDEX_H__ #define SPARSE_INDEX_H__ +#include "strbuf.h" + /* * If performing an operation where the index is supposed to expand to a * full index, then disable the advice message by setting this global to @@ -54,4 +56,8 @@ void ensure_full_index_with_reason(struct index_state *istate, const char *fmt, ...); +#define ensure_full_index_unaudited(i) \ + ensure_full_index_with_reason((i), \ + "unaudited call (%s.%d)", __FILE__, __LINE__); + #endif