@@ -61,8 +61,7 @@ static void merge_one_path(const char *path)
static void merge_all(void)
{
int i;
- /* TODO: audit for interaction with sparse-index. */
- ensure_full_index(&the_index);
+
for (i = 0; i < the_index.cache_nr; i++) {
const struct cache_entry *ce = the_index.cache[i];
if (!ce_stage(ce))
@@ -122,7 +121,6 @@ int cmd_merge_index(int argc, const char **argv, const char *prefix)
/* TODO: audit for interaction with sparse-index. */
ensure_full_index(&the_index);
-
if (all)
merge_all();
else
When most of the ensure_full_index() calls were added in 8e97852919f (Merge branch 'ds/sparse-index-protections', 2021-04-30) we could add them at the start of cmd_*() for built-ins, but in some cases we couldn't do that, as we'd only want to initialize the index conditionally on some branches in the code. But this code added in 299e2c4561b (merge-index: ensure full index, 2021-04-01) (part of 8e97852919f) isn't such a case. The merge_all() function is only called by cmd_merge_index(), which before calling it will have called ensure_full_index() unconditionally. We can therefore skip this. While we're at it, and mainly so that we'll see the relevant code in the context, let's fix a minor whitespace issue that the addition of the ensure_full_index() call in 299e2c4561b introduced. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- builtin/merge-index.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)