]> git.ipfire.org Git - thirdparty/git.git/commitdiff
stash: ensure full index
authorDerrick Stolee <dstolee@microsoft.com>
Thu, 1 Apr 2021 01:49:52 +0000 (01:49 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Apr 2021 20:47:26 +0000 (13:47 -0700)
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>
builtin/stash.c

index ba774cce674f339bf68d5fcda80eb8b2d8253cf2..6fb7178ef2faa153522e628632bd65ffed33ea9f 100644 (file)
@@ -1350,6 +1350,8 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
                int i;
                char *ps_matched = xcalloc(ps->nr, 1);
 
+               /* TODO: audit for interaction with sparse-index. */
+               ensure_full_index(&the_index);
                for (i = 0; i < active_nr; i++)
                        ce_path_match(&the_index, active_cache[i], ps,
                                      ps_matched);