diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2021-01-23 20:58:11 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-24 02:14:07 +0100 |
commit | fb0882648e0d624f825974aa7030e56daf6de2af (patch) | |
tree | 3d026aafbb71ed1b7b402fc0037cdcebb2df6369 /unpack-trees.c | |
parent | cache-tree: speed up consecutive path comparisons (diff) | |
download | git-fb0882648e0d624f825974aa7030e56daf6de2af.tar.xz git-fb0882648e0d624f825974aa7030e56daf6de2af.zip |
cache-tree: clean up cache_tree_update()
Make the method safer by allocating a cache_tree member for the given
index_state if it is not already present. This is preferrable to a
BUG() statement or returning with an error because future callers will
want to populate an empty cache-tree using this method.
Callers can also remove their conditional allocations of cache_tree.
Also drop local variables that can be found directly from the 'istate'
parameter.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r-- | unpack-trees.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index af6e9b9c2f..a810b79657 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -1726,8 +1726,6 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options if (!ret) { if (git_env_bool("GIT_TEST_CHECK_CACHE_TREE", 0)) cache_tree_verify(the_repository, &o->result); - if (!o->result.cache_tree) - o->result.cache_tree = cache_tree(); if (!cache_tree_fully_valid(o->result.cache_tree)) cache_tree_update(&o->result, WRITE_TREE_SILENT | |