Re: [PATCH 17/22] read-cache: read cache-tree in index-v5
On Sun, Jul 7, 2013 at 4:11 AM, Thomas Gummerer <t.gummerer@gmail.com> wrote:
Show 20 quoted lines
> Since the cache-tree data is saved as part of the directory data,
> we already read it at the beginning of the index. The cache-tree
> is only converted from this directory data.
>
> The cache-tree data is arranged in a tree, with the children sorted by
> pathlen at each node, while the ondisk format is sorted lexically.
> So we have to rebuild this format from the on-disk directory list.
>
> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
> ---
> diff --git a/read-cache-v5.c b/read-cache-v5.c
> index 193970a..f1ad132 100644
> --- a/read-cache-v5.c
> +++ b/read-cache-v5.c
> @@ -448,6 +448,103 @@ static int read_conflicts(struct conflict_entry **head,
> return 0;
> }
>
> +/*
> + * This function modifys the directory argument that is given to it.
Show 19 quoted lines
> + * Don't use it if the directory entries are still needed after.
> + */
> +static struct cache_tree *cache_tree_convert_v5(struct directory_entry *de)
> +{
> + struct directory_queue *queue;
> +
> + if (!de->de_nentries)
> + return NULL;
> + queue = xcalloc(1, sizeof(struct directory_queue));
> + queue[0].de = de;
> + queue[0].down = xcalloc(de->de_nsubtrees, sizeof(struct directory_queue));
> +
> + sort_directories(de, queue[0].down);
> + return convert_one(queue, 0);
> +}
> +
> static void resolve_undo_convert_v5(struct index_state *istate,
> struct conflict_entry *conflict)
> {