git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [QUESTION] Tracking HEAD changes?

From
Yaron Wittenstein <yaron.wittenstein@gmail.com>
Date
Feb 25, 2021, 06:01 UTC
Message-ID
<CAGgn8PfdGBuB29Gxba6OmhSagjqwH2DNUv9XyJnXUhcKpJZBsA@mail.gmail.com>
In-Reply-To
<YDc3dinQ37FY8fhD@ncase>
Thank you for the clarification!
Is there any plan to support such a case in the future?

Also, I've observed that the "post-index-change" hook is being triggered before calling the "reference-transaction" hook (with the "prepared" state). It seems not intuitive to me since the index and working dirs are being updated before approving the transaction. (the HEAD still points to an "old" reference while the "post-index-change" hook is executing).

Thank you,
   Yaron
On Thu, Feb 25, 2021 at 7:37 AM Patrick Steinhardt <ps@pks.im> wrote:
Show 30 quoted lines
>
> On Wed, Feb 24, 2021 at 04:03:14PM -0500, Jeff King wrote:
> > On Wed, Feb 24, 2021 at 10:21:55PM +0200, Yaron Wittenstein wrote:
> >
> > > That indeed seems to do the trick.
> > > I've done a little experiment and saw that when doing git reset the
> > > hook gets called.
> > >
> > > However, when switching branches the hook doesn't execute :(
> > >
> > > I don't understand if it's intentional, since when I've moved to a new
> > > branch HEAD pointed to another commit id.
> > > The only workaround I see here is using the post-checkout hook in addition.
> >
> > 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.
> >
> > -Peff
>
> 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.
>
> But this again reminds me that I still have to update the documentation
> of the hook to at least make it more explicit what's currently covered
> and what's not.
>
> Patrick
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 7 of 15 in “[QUESTION] Tracking HEAD changes?”
  1. Yaron WittensteinFeb 22, 2021
  2. Jeff KingFeb 23, 2021
  3. Jeff KingFeb 23, 2021
  4. Yaron WittensteinFeb 24, 2021
  5. Jeff KingFeb 24, 2021
  6. Patrick SteinhardtFeb 25, 2021
  7. Yaron WittensteinFeb 25, 2021
  8. Patrick SteinhardtFeb 25, 2021
  9. Junio C HamanoFeb 25, 2021
  10. Patrick SteinhardtFeb 25, 2021
  11. Yaron WittensteinFeb 25, 2021
  12. Jeff KingFeb 26, 2021
  13. Yaron WittensteinFeb 26, 2021
  14. Jeff KingMar 1, 2021
  15. Yaron WittensteinMar 1, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.