Skip to content

Commit ec6a8f9

Browse files
jonathantanmygitster
authored andcommitted
index-pack: make get_base_data() comment clearer
A comment mentions that we may free cached delta bases via find_unresolved_deltas(), but that function went away in f08cbf6 (index-pack: make quantum of work smaller, 2020-09-08). Since we need to rewrite that comment anyway, make the entire comment clearer. Signed-off-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bebe171 commit ec6a8f9

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

builtin/index-pack.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -888,18 +888,15 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
888888
}
889889

890890
/*
891-
* Walk from current node up
892-
* to top parent if necessary to deflate the node. In normal
893-
* situation, its parent node would be already deflated, so it just
894-
* needs to apply delta.
891+
* Ensure that this node has been reconstructed and return its contents.
895892
*
896-
* In the worst case scenario, parent node is no longer deflated because
897-
* we're running out of delta_base_cache_limit; we need to re-deflate
898-
* parents, possibly up to the top base.
899-
*
900-
* All deflated objects here are subject to be freed if we exceed
901-
* delta_base_cache_limit, just like in find_unresolved_deltas(), we
902-
* just need to make sure the last node is not freed.
893+
* In the typical and best case, this node would already be reconstructed
894+
* (through the invocation to resolve_delta() in threaded_second_pass()) and it
895+
* would not be pruned. However, if pruning of this node was necessary due to
896+
* reaching delta_base_cache_limit, this function will find the closest
897+
* ancestor with reconstructed data that has not been pruned (or if there is
898+
* none, the ultimate base object), and reconstruct each node in the delta
899+
* chain in order to generate the reconstructed data for this node.
903900
*/
904901
static void *get_base_data(struct base_data *c)
905902
{

0 commit comments

Comments
 (0)