From: Ævar Arnfjörð Bjarmason Date: Sat, 17 Mar 2018 21:26:21 GMT Subject: Re: [PATCH v5 04/11] pack-objects: use bitfield for object_entry::depth Message-ID: <87h8pecs1u.fsf@evledraar.gmail.com> In-Reply-To: <20180317141033.21545-5-pclouds@gmail.com> On Sat, Mar 17 2018, Nguyễn Thái Ngọc Duy jotted: > Because of struct packing from now on we can only handle max depth > 4095 > [...] > + if (depth >= (1 << OE_DEPTH_BITS)) > + die(_("delta chain depth %d is greater than maximum limit %d"), > + depth, (1 << OE_DEPTH_BITS)); > + This has a off-by-one error: $ git repack --depth=4096 fatal: delta chain depth 4096 is greater than maximum limit 4096 Per the check we should be feeding `(1 << OE_DEPTH_BITS) - 1` to die().