[PATCH 04/11] pack-bitmap.c: compare `base_offset` to `delta_obj_offset`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When comparing the offsets of either half of a delta/base-pair, we
compare `base_offset` to `offset`.

There is nothing functionally wrong with that comparison, but it is
slightly confusing, since `offset` points to just after the delta
object's type header in the pack, whereas `base_offset` points to the
beginning of the header.

In practice, that distinction does not matter, and it is perfectly
fine to compare base_offset to offset.

But we already make a copy of `offset` before it is moved forward by
calling the function `unpack_object_header()`. So let's use that copy
(which points at the beginning of the delta object's header) in the
comparison so that we are comparing like quantities.

Signed-off-by: Taylor Blau <me@xxxxxxxxxxxx>
---
 pack-bitmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pack-bitmap.c b/pack-bitmap.c
index faabc0ba0e9..3e1034cabf3 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -2117,7 +2117,7 @@ static int try_partial_reuse(struct bitmap_index *bitmap_git,
 			 * position, since the bits are ordered by their
 			 * positions within the pack.
 			 */
-			if (base_offset >= offset)
+			if (base_offset >= delta_obj_offset)
 				return 0;
 			if (offset_to_pack_pos(pack->p, base_offset,
 					       &base_bitmap_pos) < 0)
-- 
2.47.0.11.g487258bca34





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux