Re: [PATCH 2/3] pack-object: simplify --filter handling
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Nov 12, 2022, 11:45 UTC
- Message-ID
- <221112.867d00mlv9.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <59abb8d2-e8e6-7423-ead8-49382293aaa6@web.de>
On Sat, Nov 12 2022, René Scharfe wrote:
Show 9 quoted lines
> 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...