Subject: Re: [PATCH 2/3] pack-object: simplify --filter handling

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Sat, 12 Nov 2022 12:45:08 +0100

On Sat, Nov 12 2022, René Scharfe wrote:

> pack-objects uses OPT_PARSE_LIST_OBJECTS_FILTER_INIT() to initialize the
> a rev_info struct lazily before populating its filter member using the
> --filter option values.  It tracks whether the initialization is needed
> using the .have_revs member of the callback data.
>
> There is a better way: Use a stand-alone list_objects_filter_options
> struct and build a rev_info struct with its .filter member after option
> parsing.  This allows using the simpler OPT_PARSE_LIST_OBJECTS_FILTER()
> and getting rid of the extra callback mechanism.

I haven't gone through the history again, but as I recall this used to
be outside of "struct rev_info", then (I think I did, as part of a leak
fix) it was put there, and now it's still there, but we make a copy of
it, then copy it into the "rev_info" struct again.

Maybe we've finally reached the right trade-off here, but it would help
to discuss some of those past commits, why those arrangements were
wrong, and why this is finally the right one...