summaryrefslogtreecommitdiff
path: root/pack-objects.h
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-04-14 15:35:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-04-16 03:38:59 (GMT)
commit27a7d0679f17bd536f566e76e51058de0e1fa17a (patch)
treebddb22342ff1e11888fad86db46a4d981041b6d5 /pack-objects.h
parent660b373542589157aff78dd37ce582237027ba94 (diff)
downloadgit-27a7d0679f17bd536f566e76e51058de0e1fa17a.zip
git-27a7d0679f17bd536f566e76e51058de0e1fa17a.tar.gz
git-27a7d0679f17bd536f566e76e51058de0e1fa17a.tar.bz2
pack-objects: clarify the use of object_entry::size
While this field most of the time contains the canonical object size, there is one case it does not: when we have found that the base object of the delta in question is also to be packed, we will very happily reuse the delta by copying it over instead of regenerating the new delta. "size" in this case will record the delta size, not canonical object size. Later on in write_reuse_object(), we reconstruct the delta header and "size" is used for this purpose. When this happens, the "type" field contains a delta type instead of a canonical type. Highlight this in the code since it could be tricky to see. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-objects.h')
-rw-r--r--pack-objects.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/pack-objects.h b/pack-objects.h
index 9d0391c..e4ea6a3 100644
--- a/pack-objects.h
+++ b/pack-objects.h
@@ -32,7 +32,9 @@ enum dfs_state {
*
* "size" is the uncompressed object size. Compressed size of the raw
* data for an object in a pack is not stored anywhere but is computed
- * and made available when reverse .idx is made.
+ * and made available when reverse .idx is made. Note that when a
+ * delta is reused, "size" is the uncompressed _delta_ size, not the
+ * canonical one after the delta has been applied.
*
* "hash" contains a path name hash which is used for sorting the
* delta list and also during delta searching. Once prepare_pack()