Subject: Re: [PATCH v1 1/3] pack-bitmap.c: use "ret" in "open_midx_bitmap()

From: Taylor Blau <[email-masked]>
Date: Tue, 29 Mar 2022 22:39:01 -0400

On Mon, Mar 28, 2022 at 03:59:07PM +0800, Teng Long wrote:
> Although all MIDX bitmap are scanned, only one of them will eventually work
> , and there seems to be no guarantee that the last MIDX that works is the
> most appropriate one? (with the same comfusion applies to non-MIDX
> bitmap's behavour...)

I think your "which is the most appropriate one?" exactly highlights the
problem. Since Git can only handle one .bitmap file at a time, we should
tell the user when we found more than one candidate.

In this case, they may be expecting or depending on a particular choice
for performance reasons, and so may be rather surprised or upset if Git
chose a different available .bitmap.

The one exception to this is when we have both a single- and multi-pack
bitmap available, in which case it almost always makes more sense to
pick the multi-pack bitmap. So we don't complain in this case (i.e., if
open_midx_bitmap() succeeds, we immediately return success from
open_bitmap() and proceed to have prepare_bitmap_git() call
load_bitmap() on the previous result without even bothering to check for
pack bitmaps).

Thanks,
Taylor