]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sparse-index: include EXTENDED flag when expanding
authorDerrick Stolee <dstolee@microsoft.com>
Wed, 14 Jul 2021 13:12:26 +0000 (13:12 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Jul 2021 20:42:21 +0000 (13:42 -0700)
When creating a full index from a sparse one, we create cache entries
for every blob within a given sparse directory entry. These are
correctly marked with the CE_SKIP_WORKTREE flag, but the CE_EXTENDED
flag is not included. The CE_EXTENDED flag would exist if we loaded a
full index from disk with these entries marked with CE_SKIP_WORKTREE, so
we can add the flag here to be consistent. This allows us to directly
compare the flags present in cache entries when testing the sparse-index
feature, but has no significance to its correctness in the user-facing
functionality.

Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sparse-index.c

index 2c6959302755dad6443bd0d76dbf938a07e1c5ef..ef53bd2198b479b82e0f3c415e1faf8c9249a34d 100644 (file)
@@ -213,7 +213,7 @@ static int add_path_to_index(const struct object_id *oid,
        strbuf_addstr(base, path);
 
        ce = make_cache_entry(istate, mode, oid, base->buf, 0, 0);
-       ce->ce_flags |= CE_SKIP_WORKTREE;
+       ce->ce_flags |= CE_SKIP_WORKTREE | CE_EXTENDED;
        set_index_entry(istate, istate->cache_nr++, ce);
 
        strbuf_setlen(base, len);