]> git.ipfire.org Git - thirdparty/git.git/commitdiff
index: raise a bug if the index is materialised more than once
authorAnh Le <anh@canva.com>
Thu, 3 Nov 2022 23:05:01 +0000 (23:05 +0000)
committerTaylor Blau <me@ttaylorr.com>
Sat, 5 Nov 2022 00:28:28 +0000 (20:28 -0400)
If clear_skip_worktree_from_present_files() encounter a sparse directory,
it fully materialise the index which should expand any sparse directories
and start going through each entries again. If this happens more than once,
raise it with a BUG.

Signed-off-by: Anh Le <anh@canva.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
sparse-index.c

index 8713a15611d5c175a2c67913a32a297fd761ca4b..8c269dab803fa9a06a0e31ff42b6a20ec1983dbc 100644 (file)
@@ -510,6 +510,8 @@ restart:
                        path_count[restarted]++;
                        if (path_found(ce->name, &last_dirname, &dir_len, &dir_found)) {
                                if (S_ISSPARSEDIR(ce->ce_mode)) {
+                                       if (restarted)
+                                               BUG("ensure-full-index did not fully flatten?");
                                        ensure_full_index(istate);
                                        restarted = 1;
                                        goto restart;