Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2021-01-23 22:58:11 +0300
committerJunio C Hamano <gitster@pobox.com>2021-01-24 04:14:07 +0300
commitfb0882648e0d624f825974aa7030e56daf6de2af (patch)
tree3d026aafbb71ed1b7b402fc0037cdcebb2df6369 /unpack-trees.c
parenta4b6d202caad83c6dc29abe9b17e53a1b3fb54a0 (diff)
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.c2
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 |