diff mbox series

index-pack: make get_base_data() comment clearer

Message ID 20201007201658.1322116-1-jonathantanmy@google.com (mailing list archive)
State Accepted
Commit ec6a8f9705cb61956f7fac61a4c0e27d9ae4bbd5
Headers show
Series index-pack: make get_base_data() comment clearer | expand

Commit Message

Jonathan Tan Oct. 7, 2020, 8:16 p.m. UTC
A comment mentions that we may free cached delta bases via
find_unresolved_deltas(), but that function went away in f08cbf60fe
(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 <jonathantanmy@google.com>
---
OK - here it is, with "reconstruct" instead of "uncompress". This
replaces patch 3 of Peff's patch set.
---
 builtin/index-pack.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

Comments

Junio C Hamano Oct. 7, 2020, 8:46 p.m. UTC | #1
Jonathan Tan <jonathantanmy@google.com> writes:

> A comment mentions that we may free cached delta bases via
> find_unresolved_deltas(), but that function went away in f08cbf60fe
> (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 <jonathantanmy@google.com>
> ---
> OK - here it is, with "reconstruct" instead of "uncompress". This
> replaces patch 3 of Peff's patch set.

Thanks.  Will replace.
diff mbox series

Patch

diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 8acd078aa0..53e8a1a022 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -894,18 +894,15 @@  static void sha1_object(const void *data, struct object_entry *obj_entry,
 }
 
 /*
- * Walk from current node up
- * to top parent if necessary to deflate the node. In normal
- * situation, its parent node would be already deflated, so it just
- * needs to apply delta.
+ * Ensure that this node has been reconstructed and return its contents.
  *
- * In the worst case scenario, parent node is no longer deflated because
- * we're running out of delta_base_cache_limit; we need to re-deflate
- * parents, possibly up to the top base.
- *
- * All deflated objects here are subject to be freed if we exceed
- * delta_base_cache_limit, just like in find_unresolved_deltas(), we
- * just need to make sure the last node is not freed.
+ * In the typical and best case, this node would already be reconstructed
+ * (through the invocation to resolve_delta() in threaded_second_pass()) and it
+ * would not be pruned. However, if pruning of this node was necessary due to
+ * reaching delta_base_cache_limit, this function will find the closest
+ * ancestor with reconstructed data that has not been pruned (or if there is
+ * none, the ultimate base object), and reconstruct each node in the delta
+ * chain in order to generate the reconstructed data for this node.
  */
 static void *get_base_data(struct base_data *c)
 {