Re: [PATCH 1/1] ls-refs.c: minimize number of refs visited
From: Jacob Vosmaer <hidden>
Date: 2021-01-20 11:33:44
On Wed, Jan 20, 2021 at 12:11 AM Jeff King [off-list ref] wrote:
It's not a _huge_ deal to me, but I think it is slightly nicer as a separate patch. Plus it can easily be credited to Jacob, so at least he gets some authorship credit out of this. :)
Thanks, I'm fine either way. Just remember that the other changes in ls-refs.c depend on that strvec_init, so if we split it out, we need to remember / maintain that (order) dependency.
Having now looked carefully at the ls-refs code, it's a pure prefix-match, too. So I think we _could_ rely on for_each_fullref_in() returning us the correct full results, and not checking it further in send_ref().
I also think we could. But as I alluded to in my original commit message, I don't like how complicated that gets. I find it easier to convince myself in the current form that the longest prefix code selects _enough_ prefixes, which is a weaker property than "selects exactly the right prefixes". Jacob