summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Derrick Stolee <dstolee@microsoft.com>2021-04-01 01:49:52 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-04-14 13:47:26 -0700
commita02912019a7a473b039d28713fb6419bf472386f (patch)
tree55ee3c590e2be8dafc23f77156a33652424b2601 /builtin
parentrm: ensure full index (diff)
downloadtgif-a02912019a7a473b039d28713fb6419bf472386f.tar.xz
stash: ensure full index
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/stash.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/stash.c b/builtin/stash.c
index ba774cce67..6fb7178ef2 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -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);