]> git.ipfire.org Git - thirdparty/git.git/commit
cache-tree: clean up cache_tree_update()
authorDerrick Stolee <dstolee@microsoft.com>
Sat, 23 Jan 2021 19:58:11 +0000 (19:58 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 Jan 2021 01:14:07 +0000 (17:14 -0800)
commitfb0882648e0d624f825974aa7030e56daf6de2af
tree3d026aafbb71ed1b7b402fc0037cdcebb2df6369
parenta4b6d202caad83c6dc29abe9b17e53a1b3fb54a0
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>
builtin/checkout.c
cache-tree.c
sequencer.c
unpack-trees.c