Re: [PATCH 09/11] midx-write.c: factor out common want_included_pack() routine
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 25, 2024, 20:36 UTC
- Message-ID
- <xmqqo7b2hwv3.fsf@gitster.g>
- In-Reply-To
- <5475b09a7afc4d55a8e1a1a72f20fa9109447cec.1711387439.git.me@ttaylorr.com>
Taylor Blau <me@ttaylorr.com> writes:
Show 25 quoted lines
> diff --git a/midx-write.c b/midx-write.c
> index 89e325d08e..2f0f5d133f 100644
> --- a/midx-write.c
> +++ b/midx-write.c
> @@ -1349,6 +1349,24 @@ static int compare_by_mtime(const void *a_, const void *b_)
> return 0;
> }
>
> +static int want_included_pack(struct repository *r,
> + struct multi_pack_index *m,
> + int pack_kept_objects,
> + uint32_t pack_int_id)
> +{
> + struct packed_git *p;
> + if (prepare_midx_pack(r, m, pack_int_id))
> + return 0;
> + p = m->packs[pack_int_id];
> + if (!pack_kept_objects && p->pack_keep)
> + return 0;
> + if (p->is_cruft)
> + return 0;
> + if (open_pack_index(p) || !p->num_objects)
> + return 0;
> + return 1;
> +}OK, makes sense to return false when we do not want the caller proceed with the pack for a function whose name is want_*_pack().