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

Re: rebasing commits that have notes, was Re: Git Notes idea.

From
Johan Herland <johan@herland.net>
Date
Dec 17, 2008, 09:15 UTC
Message-ID
<200812171015.45303.johan@herland.net>
In-Reply-To
<alpine.DEB.1.00.0812170110160.14632@racer>
On Wednesday 17 December 2008, Johannes Schindelin wrote:
Show 12 quoted lines
> Hi,
>
> On Tue, 16 Dec 2008, Jeff King wrote:
> >   Some discussion of the interaction of notes and rebase:
> >   http://thread.gmane.org/gmane.comp.version-control.git/100533
>
> Oh, I misinterpreted that label... of course you can track rebases in
> notes, but some issue that we did not look into yet (I think) is the
> issue that you can cherry-pick and rebase commits and lose notes in the
> process.
>
> It seems that the notes idea is not that unintrusive as I thought...
So we have two issues here:
1. Using notes to annotate the rebase/cherry-pick action itself.
2. Preserving (or at least giving the user the option of preserving) notes 
across a rebase/cherry-pick.

I think issue #1 has already been discussed, and is largely resolved: People can do this if they want to; it probably only makes sense when rebasing/cherry-picking public branches; etc... AFAICS there are no remaining problems here that needs an intrusive solution (see below for one such unintrusive alternative).

Issue #2, however, is a little more involved. We can discuss the merits of wanting to preserve notes across a rebase/cherry-pick itself; e.g. when it makes sense to preserve notes, and when it doesn't make sense, but I think this is orthogonal to the issue of HOW to preserve them, so instead of focusing on WHY, I'll focus on HOW:

If notes are named according to the "refs/notes:<first byte in hex>/<rest of bytes>/<referenced object SHA-1>" scheme (and AFAICS this is still being discussed, so it's indeed a big IF), then rebase/cherry-pick of the referenced object simply translates to a rename/copy of the corresponding note (this is of course assuming that the note itself does not contain the SHA-1 of the referenced object). This could probably be solved fairly unintrusively in the current code, but there are (as always) complications:

- The user may want to amend the note after the rebase/cherry-pick (just as 
(s)he may want to amend the commit message).
- In some cases it may even make sense to fold (parts of) the note _into_ 
the commit message.
- probably more reasons...

So what about the following proposal: Add hooks that are invoked by rebase/cherry-pick with the <from-SHA1> and <to-SHA1> as arguments. A typical hook script can then use this information to look up notes referencing <from-SHA1> and update these to reference <to-SHA1> instead, and in the process, prompt the user to do whatever changes (s)he wants to. The hook scripts can do other things as well, e.g. implementing issue #1 above (adding notes for annotating the rebase/cherry-pick itself.)

Have fun! :)
...Johan
PS: What's the current status on git-sequencer? It's probably the best place 
to invoke these hooks.
-- 
Johan Herland, <johan@herland.net>
www.herland.net
Previous: Johannes SchindelinNext: Stephan Beyer
Message 12 of 41 in “Git Notes idea.”
  1. Govind SalinasDec 16, 2008
  2. Jeff KingDec 16, 2008
  3. Jeff KingDec 16, 2008
  4. Govind SalinasDec 16, 2008
  5. Johannes SchindelinDec 16, 2008
  6. Jeff KingDec 17, 2008
  7. Petr BaudisDec 17, 2008
  8. Jeff KingDec 17, 2008
  9. Govind SalinasDec 17, 2008
  10. Jeff KingDec 18, 2008
  11. rebasing commits that have notes, was Re: Git Notes idea.Johannes Schindelin, Dec 17, 2008
  12. Johan HerlandDec 17, 2008
  13. Stephan BeyerDec 17, 2008
  14. 0/4 Notes reloadedJohannes Schindelin, Dec 19, 2008
  15. 1/4 Introduce commit notesJohannes Schindelin, Dec 19, 2008
  16. Jeff KingDec 20, 2008
  17. Robin RosenbergDec 20, 2008
  18. Jeff KingDec 20, 2008
  19. Junio C HamanoDec 20, 2008
  20. Jeff KingDec 20, 2008
  21. Junio C HamanoDec 20, 2008
  22. 0/4 Notes, reloadedJohannes Schindelin, Dec 20, 2008
  23. 1/4 Introduce commit notesJohannes Schindelin, Dec 20, 2008
  24. 2/4 Add a script to edit/inspect notesJohannes Schindelin, Dec 20, 2008
  25. 3/4 Speed up git notes lookupJohannes Schindelin, Dec 20, 2008
  26. 4/4 Add an expensive test for git-notesJohannes Schindelin, Dec 20, 2008
  27. 2/4 Add a script to edit/inspect notesJohannes Schindelin, Dec 19, 2008
  28. 3/4 Speed up git notes lookupJohannes Schindelin, Dec 19, 2008
  29. 4/4 Add an expensive test for git-notesJohannes Schindelin, Dec 19, 2008
  30. Boyd Stephen Smith Jr.Dec 19, 2008
  31. Johannes SchindelinDec 20, 2008
  32. Jeff KingDec 17, 2008
  33. Johannes SchindelinDec 17, 2008
  34. Junio C HamanoDec 17, 2008
  35. Johannes SchindelinDec 18, 2008
  36. Govind SalinasDec 19, 2008
  37. Govind SalinasDec 19, 2008
  38. Govind SalinasDec 19, 2008
  39. Jeff KingDec 19, 2008
  40. Govind SalinasDec 19, 2008
  41. Jeff KingDec 20, 2008

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.