Thank you all! I'd like to make sure I understand the way things are right now: 1. The reference-transaction hook as it's today doesn't intercept symbolic-references changes. It means that when HEAD changes due to branch-switching the hook won't get called. Are there any other cases that today the transaction won't execute? (I couldn't think of one) 2. The mechanisms that handle the changes to index and working-dir are isolated from the one that manages the refs updates. A side-effect to that is the post-index-change hook running before the reference-transaction one. Future code changes to the way git operates could result in the reference-transaction hook running before the post-index-change one. Is that correct? Thank you! Yaron On Fri, Feb 26, 2021 at 7:59 AM Jeff King <peff@xxxxxxxx> wrote: > > On Thu, Feb 25, 2021 at 06:36:54AM +0100, Patrick Steinhardt wrote: > > > > Hmm, I would have thought that the branch switch would trigger the hooks > > > because they're updating HEAD. I wonder if that is a bug (or lack of > > > feature :) ) in the transaction hooks, or something Patrick did > > > intentionally. > > > > It was done semi-intentionally, or at least with the knowledge that > > symrefs aren't covered. This is mostly because they're not covered by > > the reference transaction mechanism itself. > > Ah, right, I forgot about that. That might be something that we'd want > to fix if anybody wanted to use the transaction hooks to track the > complete state of refs. > > At GitHub, our repository replication does track symbolic ref updates, > but we handle it outside of Git. Our normal ref updates use a few custom > bits of code similar to your transaction hooks in order to implement a > 3-phase commit. But our symref updates don't; they just take a lock, run > git-symbolic-ref on each, and then vote on the result. This is slower > and less robust, but symbolic ref updates are relatively rare, so it > hasn't been a big deal. > > -Peff