Subject: Re: [PATCH v3 11/20] sparse-index: convert from full to sparse

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Wed, 17 Mar 2021 14:43:36 +0100

On Tue, Mar 16 2021, Derrick Stolee via GitGitGadget wrote:

> diff --git a/cache-tree.c b/cache-tree.c
> index 2fb483d3c083..5f07a39e501e 100644
> --- a/cache-tree.c
> +++ b/cache-tree.c
> @@ -6,6 +6,7 @@
>  #include "object-store.h"
>  #include "replace-object.h"
>  #include "promisor-remote.h"
> +#include "sparse-index.h"
>  
>  #ifndef DEBUG_CACHE_TREE
>  #define DEBUG_CACHE_TREE 0
> @@ -442,6 +443,8 @@ int cache_tree_update(struct index_state *istate, int flags)
>  	if (i)
>  		return i;
>  
> +	ensure_full_index(istate);
> +
>  	if (!istate->cache_tree)
>  		istate->cache_tree = cache_tree();
>  
> diff --git a/cache.h b/cache.h
> index 759ca92e2ecc..69a32146cd77 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -251,6 +251,8 @@ static inline unsigned int create_ce_mode(unsigned int mode)
>  {
>  	if (S_ISLNK(mode))
>  		return S_IFLNK;
> +	if (mode == S_IFDIR)
> +		return S_IFDIR;

Does this actually need to be mode == S_IFDIR v.s. S_ISDIR(mode)? Those
aren't the same thing...

>  	if (S_ISDIR(mode) || S_ISGITLINK(mode))
>  		return S_IFGITLINK;

...and if it can be S_ISDIR(mode) then this becomes just
S_ISGITLINK(mode), but losing the "if" there makes me suspect that some
dir == submodule heuristic is being broken somewhere..