diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2021-01-23 22:58:11 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-24 04:14:07 +0300 |
commit | fb0882648e0d624f825974aa7030e56daf6de2af (patch) | |
tree | 3d026aafbb71ed1b7b402fc0037cdcebb2df6369 /builtin/checkout.c | |
parent | a4b6d202caad83c6dc29abe9b17e53a1b3fb54a0 (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 'builtin/checkout.c')
-rw-r--r-- | builtin/checkout.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c index c9ba23c279..2d6550bc3c 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -821,9 +821,6 @@ static int merge_working_tree(const struct checkout_opts *opts, } } - if (!active_cache_tree) - active_cache_tree = cache_tree(); - if (!cache_tree_fully_valid(active_cache_tree)) cache_tree_update(&the_index, WRITE_TREE_SILENT | WRITE_TREE_REPAIR); |