Re: [PATCH v2 0/6] refs: excessive hook execution with packed refs
- From
Han-Wen Nienhuys <hanwen@google.com>
- Date
- Jan 13, 2022, 18:24 UTC
- Message-ID
- <CAFQ2z_P_SiaDbSQdAt5mSp79BnC0-k5B+X09oCVh+w--BO4_6w@mail.gmail.com>
- In-Reply-To
- <xmqqiluv6vim.fsf@gitster.g>
On Fri, Jan 7, 2022 at 11:17 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 8 quoted lines
> > this is a resend of version 1 of this patch series to hopefully entice > > some reviews. The only change is that v2 is rebased onto the current > > main branch at commit e83ba647f7 (The seventh batch, 2022-01-05). The > > following was from the orignial cover letter: > > I'll add Ævar, who has been making a lot of changes to the refs > subsystem, and Han-Wen, whose work to add a new ref backend may need > to interact with this change, as possible stake-holders to the CC list.
Thanks for the consideration, Jun. As the hook is called from refs.c, it should not make a difference for reftable.
I looked over the patches. I didn't look at the bottom change to packed/loose refs as I'm not an expert.
The individual transaction updates already support their own flags, so this change generates some confusion. Consider:
int refs_delete_ref(struct ref_store *refs, const char *msg,
const char *refname,
const struct object_id *old_oid,
unsigned int flags)how would one delete a ref skipping the transaction hook? It will be easy for someone to pass the SKIP_TRANSACTION_HOOK to refs_delete_ref(), with surprising results.
It might make sense to not introduce a new flag namespace, but use update->flags instead. You'd have to add your new flag after REF_SKIP_REFNAME_VERIFICATION. Bonus is that you can unittest the new flag using the existing ref-store helper without extra work. (check that a transaction with & without the flag works as expected.)
other than that, looks OK to me.
-- Han-Wen Nienhuys - Google Munich I work 80%. Don't expect answers from me on Fridays. -- Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Paul Manicle, Halimah DeLaine Prado