Re: [PATCH v2 00/10] reftable: stop using `struct strbuf`
From: Patrick Steinhardt <hidden>
Date: 2024-10-15 04:37:44
On Mon, Oct 14, 2024 at 06:44:35PM -0400, Taylor Blau wrote:
On Mon, Oct 14, 2024 at 03:02:16PM +0200, Patrick Steinhardt wrote:quoted
Hi, this is the second part of my patch series that stop using `struct strbuf` in the reftable library. This is done such that the reftable library becomes standalone again and so that we can use the pluggable allocators part of the library.I reviewed this round, and it looks generally good to me. I feel somewhat unhappy to have to force the reftable backend to implement its own strbuf-like functionality. So I think it may be worth considering whether or not we can reuse Git's strbuf implementation through a vtable or similar. But it may not be immediately possible since that implementation just die()s on error, can't easily swap out the allocator, etc. So perhaps this is the best path forward, it just feels somewhat unsatisfying to me.
It's not perfect, I agree. I initially tried to do something like a vtable or to even compile this into code with something like a wrapper structure. But that approach in the end fell flat. So I decided to be pragmatic about this whole issue and just duplicate some code -- overall, we are talking about ~200 lines of code to completely detangle the reftable library from libgit.a. For what it's worth, I also had this discussion with Junio in [1], in which we ultimately agreed that this is probably the best way forward. Patrick [1]: [ref]