summaryrefslogtreecommitdiff
path: root/commit-slab.h
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2025-07-25 00:11:36 +0200
committerJunio C Hamano <gitster@pobox.com>2025-07-24 15:31:09 -0700
commit9201261a70b5d325b344036de15901a4064d66c0 (patch)
treef9d23aec6a190e38e3f712ce0e1d39773c035303 /commit-slab.h
parentdabecb9db2b25a32d72c90832f338849b665fdf9 (diff)
ref-cache: set prefix_state when seeking
In 090eb5336c (refs: selectively set prefix in the seek functions, 2025-07-15) we separated the seeking functionality of reference iterators from the functionality to set prefix to an iterator. This allows users of ref iterators to seek to a particular reference to provide pagination support. The files-backend, uses the ref-cache iterator to iterate over loose refs. The iterator tracks directories and entries already processed via a stack of levels. Each level corresponds to a directory under the files backend. New levels are added to the stack, and when all entries from a level is yielded, the corresponding level is popped from the stack. To accommodate seeking, we need to populate and traverse the levels to stop the requested seek marker at the appropriate level and its entry index. Each level also contains a 'prefix_state' which is used for prefix matching, this allows the iterator to skip levels/entries which don't match a prefix. The default value of 'prefix_state' is PREFIX_CONTAINS_DIR, which yields all entries within a level. When purely seeking without prefix matching, we want to yield all entries. The commit however, skips setting the value explicitly. This causes the MemorySanitizer to issue a 'use-of-uninitialized-value' error when running 't/t6302-for-each-ref-filter'. Set the value explicitly to avoid to fix the issue. Reported-by: Kyle Lippincott <spectral@google.com> Helped-by: Kyle Lippincott <spectral@google.com> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-slab.h')
0 files changed, 0 insertions, 0 deletions