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

Re: Gerrit, GitButler, and Jujutsu projects collaborating on change-id commit footer

From
Elijah Newren <newren@gmail.com>
Date
Apr 4, 2025, 02:28 UTC
Message-ID
<CABPp-BECTrVp9X6bVmzU8LEeYsC3KbzeJvAaDPN+FgZz_uEhmA@mail.gmail.com>
In-Reply-To
<D8X5I3W7K1DI.2JYHGNY9L7ZD3@buenzli.dev>
On Thu, Apr 3, 2025 at 9:40 AM Remo Senekowitsch <remo@buenzli.dev> wrote:
Show 37 quoted lines
>
> On Thu Apr 3, 2025 at 5:39 PM CEST, Elijah Newren wrote:
> > On Wed, Apr 2, 2025 at 11:48 AM Martin von Zweigbergk
> > <martinvonz@google.com> wrote:
> >>
> >> There are many benefits to having a change id even if it's just
> >> local. I mentioned some in my email to this mailing list in [1].
> >> For example, it enables
> >> `git rebase main <change ID>; git switch <change ID>` without
> >> requiring the user to look up the hash of the rewritten commit.
> >
> > But <change ID> isn't unique, right?  The whole point of having the
> > change ID is to preserve it despite edits (e.g. rebase, commit
> > --amend, cherry-pick), meaning that you end up with multiple commits
> > with the same <change ID>.
> >
> > Why would this work?
> >
> > And if it does work, isn't it expensive since you'd need to walk
> > history to find it?  Or do you keep an extra lookup table on the side
> > somewhere?
>
> For rebase and commit --amend, the way Jujutsu deals with those is that
> all descendants are immediately rebased on top of the new commit, and
> refs to those descendants are updated as well. That means, the old
> version of the patch with the same change-id becomes unreachable. So,
> at least most of the time, the change-id is indeed unique.
>
> This doesn't work for cherry-pick, more on that below.
>
> Some of these features are not in Git yet, at least not to my knowledge.
> That means getting the full benefit of change-ids with Git itself
> would indeed require some more work. I know of rebase.updateRefs
> and rebase.rebaseMerges, which move the Git experience closer to
> Jujutsu, but don't go all the way. AFAIK it's not possible with Git to
> automatically rebase --update-refs all descendants of a commit that is
> amended or rebased.
Correct; that doesn't exist currently.
> Jujutsu does keep a separate index of change-ids, yes.
Thanks.
Show 29 quoted lines
> >> There is a design doc [2] about the impact on Gerrit and how to
> >> handle various cases where the client doesn't understand the
> >> `change-id` header. That also includes some discussion about
> >> whether cherry-picking should preserve the change id or create a
> >> new one. I think there is a lot of value in having a
> >> standardized header regardless of what we decide about
> >> cherry-picks.
> >
> > cherry-pick & rebase preserve author name, email & time, while
> > creating a new committer name, email, & time.  To me, the change-id is
> > about the authorship, and since these commands already preserve
> > authorship, it'd seem weird to me to have cherry-pick not preserve the
> > change-id by default.
>
> I'd say Jujutsu, Gerrit and GitButler think of a change-id as associated
> with a unit of review. (Although it will naturally support reviewing
> sets of patches as well.) Usually only one person will push commits with
> the same change-id, just like people don't usually force-push over each
> others branches. But that's mostly about avoiding logistical problems.
> When an employee leaves a company or is on vacation, it can be perfectly
> reasonable for someone else to take over their work. In that case, it
> would be appropriate to preserve the change-id, even though authorship
> has changed, because the history of code review on that patch should
> stay associated with the new version.
>
> Cherry-picking on the other hand often represents a separate unit of
> review. That review may revolve around whether it makes sense to
> backport a bugfix at all or any additional changes that may have been
> necessary to make the bugfix work in the different, older codebase.

I've worked with many projects hosted in Gerrit, and they all had a very different view of change-ids than what you've espoused here. They cherry-picked changes to other branches, fully expecting the change-id to be kept the same. They often checked to verify that important fixes had been backported to all the relevant LTS branches by looking for the change-id. So, we'd typically have N+1 commits sharing the same change-id, all reachable from existing branches, where N is the number of LTS versions still supported at the time (and the +1 comes from the main branch development).

Show 10 quoted lines
> As mentioned above, there's also the issue that preserving the change-id
> on cherry-pick likely results in duplicates. For Jujutsu, it would be
> nice it this was avoided. But it's not infeasible to deal with that
> either.
>
> For Gerrit, it would be important to be able to track a change across
> cherry-picks somehow, since that is a feature they already have. If Git
> decides to preserve the change-id on cherry-pick, there's no problem
> for Gerrit. Alternatives include storing a separate cherry-picked-from
> header or enabling the -x flag on cherry-pick by default.

Cherry-picked-from trailers can be nice when it exists, but much more frequently than one would want it provides a dead-end. People will cherry-pick a commit that was local-only, or only found in some security-embargoed repository, and you'd end up with dead ends. You also occasionally get chains: E cherry-picked from D, which was cherry-picked from C, which was cherry-picked from B, etc. And more complex structures are possible. And maybe part of that chain was a local-only commit or some commit from a security-embargoed repository that you don't have access to. Then folks get to write scripts and try to deduce relationships from those trailers (e.g. hey, these two commits both claim they were cherry-picked from the same non-existent commit, and this other commit was a cherry-pick of one of these two, so they're a representation of the same logical change on these different LTS branches). It makes it a hassle to try to determine which LTS branches have the appropriate fixes backported and applied. I've done it, but I thought this problem was logically the point of change-ids as found in Gerrit, honestly (well, that and its byzantine push to refs/for/$BRANCH stuff so it could automagically determine which CR that your push was supposed to be correlated with instead of just letting you specify via a real refname in your push command). While I understand that having nearly-unique change-ids let you use change-ids interchangably with commits, that seems like a questionable benefit over being able to actually track which logical changes are the same and have been applied to which LTS branches. I fully realize folks may disagree...but if we're suggesting commands like `git switch <change-id>` which can only possibly be meaningful if <change-id> is unique across all branches, then what are we supposed to do for the many projects which use change-ids for LTS backport tracking? What does `git switch <change-id>` (and any other command where you attempt to use a non-unique change-id in place of a unique commit identifier) do for them?

Previous: Kane YorkNext: Elijah Newren
Message 17 of 118 in “Gerrit, GitButler, and Jujutsu projects collaborating on change-id commit footer”
  1. Martin von ZweigbergkApr 2, 2025
  2. Remo SenekowitschApr 2, 2025
  3. Konstantin RyabitsevApr 2, 2025
  4. Konstantin RyabitsevApr 2, 2025
  5. Martin von ZweigbergkApr 2, 2025
  6. Patrick SteinhardtApr 3, 2025
  7. Remo SenekowitschApr 3, 2025
  8. Patrick SteinhardtApr 3, 2025
  9. Elijah NewrenApr 3, 2025
  10. Remo SenekowitschApr 3, 2025
  11. Elijah NewrenApr 3, 2025
  12. Martin von ZweigbergkApr 3, 2025
  13. Patrick SteinhardtApr 4, 2025
  14. Elijah NewrenApr 3, 2025
  15. Remo SenekowitschApr 3, 2025
  16. Kane YorkApr 3, 2025
  17. Elijah NewrenApr 4, 2025
  18. Elijah NewrenApr 4, 2025
  19. Martin von ZweigbergkApr 4, 2025
  20. Nico WilliamsApr 4, 2025
  21. Elijah NewrenApr 4, 2025
  22. Martin von ZweigbergkApr 4, 2025
  23. Patrick SteinhardtApr 4, 2025
  24. Theodore Ts'oApr 3, 2025
  25. Remo SenekowitschApr 3, 2025
  26. Theodore Ts'oApr 5, 2025
  27. Nico WilliamsApr 3, 2025
  28. Remo SenekowitschApr 3, 2025
  29. Martin von ZweigbergkApr 3, 2025
  30. Nico WilliamsApr 3, 2025
  31. Martin von ZweigbergkApr 3, 2025
  32. Elijah NewrenApr 4, 2025
  33. Nico WilliamsApr 4, 2025
  34. Martin von ZweigbergkApr 4, 2025
  35. Nico WilliamsApr 4, 2025
  36. Patrick SteinhardtApr 4, 2025
  37. Nico WilliamsApr 4, 2025
  38. Patrick SteinhardtApr 7, 2025
  39. Junio C HamanoApr 7, 2025
  40. Nico WilliamsApr 7, 2025
  41. Theodore Ts'oApr 8, 2025
  42. Nico WilliamsApr 8, 2025
  43. Theodore Ts'oApr 9, 2025
  44. Junio C HamanoApr 9, 2025
  45. Nico WilliamsApr 9, 2025
  46. Junio C HamanoApr 10, 2025
  47. Martin von ZweigbergkApr 10, 2025
  48. Semantics of change IDs (Re: Gerrit, GitButler, and Jujutsu projects collaborating on change-id commit footer)Nico Williams, Apr 9, 2025
  49. Junio C HamanoApr 9, 2025
  50. Nico WilliamsApr 9, 2025
  51. Eric SunshineApr 9, 2025
  52. Nico WilliamsApr 9, 2025
  53. Theodore Ts'oApr 10, 2025
  54. Junio C HamanoApr 10, 2025
  55. Theodore Ts'oApr 11, 2025
  56. Konstantin RyabitsevApr 11, 2025
  57. Junio C HamanoApr 11, 2025
  58. Theodore Ts'oApr 12, 2025
  59. Junio C HamanoApr 14, 2025
  60. Remo SenekowitschApr 15, 2025
  61. Junio C HamanoApr 16, 2025
  62. Jacob KellerApr 16, 2025
  63. Jacob KellerApr 15, 2025
  64. D. Ben KnobleApr 14, 2025
  65. Nico WilliamsApr 14, 2025
  66. Jacob KellerApr 15, 2025
  67. Remo SenekowitschApr 16, 2025
  68. D. Ben KnobleApr 22, 2025
  69. Remo SenekowitschApr 22, 2025
  70. Junio C HamanoApr 22, 2025
  71. Remo SenekowitschApr 22, 2025
  72. Nico WilliamsApr 22, 2025
  73. Remo SenekowitschApr 22, 2025
  74. Nico WilliamsApr 23, 2025
  75. Remo SenekowitschApr 23, 2025
  76. Nico WilliamsApr 23, 2025
  77. Junio C HamanoApr 22, 2025
  78. Nico WilliamsApr 23, 2025
  79. Nico WilliamsApr 23, 2025
  80. Martin von ZweigbergkApr 23, 2025
  81. Junio C HamanoApr 23, 2025
  82. Martin von ZweigbergkApr 23, 2025
  83. Toon ClaesJun 6, 2025
  84. Remo SenekowitschApr 7, 2025
  85. Junio C HamanoApr 8, 2025
  86. Martin von ZweigbergkApr 8, 2025
  87. Junio C HamanoApr 8, 2025
  88. Phillip WoodApr 8, 2025
  89. Nico WilliamsApr 8, 2025
  90. Junio C HamanoApr 12, 2025
  91. Jacob KellerApr 16, 2025
  92. Kristoffer HaugsbakkMay 14, 2025
  93. Junio C HamanoApr 8, 2025
  94. Askar SafinAug 19, 2025
  95. Ben KnobleAug 19, 2025
  96. Remo SenekowitschApr 4, 2025
  97. Nico WilliamsApr 4, 2025
  98. Remo SenekowitschApr 4, 2025
  99. Nico WilliamsApr 4, 2025
  100. Remo SenekowitschApr 23, 2025
  101. Nico WilliamsApr 23, 2025
  102. How GitLab does/doesn't need change IDs (was Re: Semantics of change IDs)Toon Claes, Apr 23, 2025
  103. Nico WilliamsApr 23, 2025
  104. D. Ben KnobleMay 10, 2025
  105. D. Ben KnobleMay 10, 2025
  106. Martin von ZweigbergkMay 10, 2025
  107. Junio C HamanoMay 12, 2025
  108. Martin von ZweigbergkMay 12, 2025
  109. Junio C HamanoMay 14, 2025
  110. Oswald BuddenhagenMay 15, 2025
  111. Jacob KellerMay 15, 2025
  112. Junio C HamanoMay 15, 2025
  113. Nico WilliamsMay 15, 2025
  114. Martin von ZweigbergkMay 12, 2025
  115. brian m. carlsonMay 12, 2025
  116. Toon ClaesJun 6, 2025
  117. Junio C HamanoJun 6, 2025
  118. D. Ben KnobleMay 13, 2025

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.