Message ID | e28df7f9395da33f24d6b75fa30081074ac6b801.1621598382.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Sparse-index: integrate with status | expand |
On 5/21/2021 7:59 AM, Derrick Stolee via GitGitGadget wrote: > From: Derrick Stolee <dstolee@microsoft.com> > > The methods traverse_by_cache_tree() and unpack_nondirectories() have > similar behavior in trying to demonstrate the difference between and > index and a tree, with some differences about how they walk the index. As I have been working on further sparse-index integrations, specifically with 'git checkout', I have found an issue with this patch that doesn't show itself in the current t1092 test script, but appears later as more complicated scenarios appear. I am pursuing the correct fix (that will also make 'git checkout' work better) but it might be a week or two before I can send a v5 with that fix. Thanks, -Stolee
diff --git a/unpack-trees.c b/unpack-trees.c index ef6a2b1c951c..22634d98e72b 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -802,6 +802,9 @@ static int traverse_by_cache_tree(int pos, int nr_entries, int nr_names, src[0] = o->src_index->cache[pos + i]; + if (S_ISSPARSEDIR(src[0]->ce_mode)) + continue; + len = ce_namelen(src[0]); new_ce_len = cache_entry_size(len); @@ -1074,6 +1077,9 @@ static int unpack_nondirectories(int n, unsigned long mask, if (mask == dirmask && !src[0]) return 0; + if (src[0] && S_ISSPARSEDIR(src[0]->ce_mode)) + return 0; + /* * Ok, we've filled in up to any potential index entry in src[0], * now do the rest.