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

Re: renormalize histroy with smudge/clean-filter

From
Elijah Newren <newren@gmail.com>
Date
Feb 7, 2025, 14:01 UTC
Message-ID
<CABPp-BFnx2m75jsa3_kTPet97HY+xwb_6JmPiKM5+OARPy=mGA@mail.gmail.com>
In-Reply-To
<CAPx1GvcyaZqYK+SvgtfsajqtkMty1jOcVAtwfmam-LpOjyd0jw@mail.gmail.com>
On Fri, Feb 7, 2025 at 3:13 AM Chris Torek <chris.torek@gmail.com> wrote:
Show 7 quoted lines
>
> > and (in the case of cherry-pick) there is not even any way to
> > renormalize before picking.
>
> That's mostly correct. The problem here is that while `git merge`
> (both recursive and the new ort) has a renormalize option
> internally, it's not exposed to cherry-pick.
Perhaps not as a config option, but it can be selected via -Xrenormalize .

However, whether it is exposed or used doesn't matter. Renormalization in the merge machinery (this is the same for both the recursive and ort backends) is something passed to xdiff[1], for doing 3-way content merges of individual files. If a merge/rebase/cherry-pick/revert doesn't need to do a 3-way content merge for some file, then no normalization will be done for it. This could happen, for example, if one side of history being merged modified a file and the other side of history being merged didn't touch that file. And as a special case, that includes when one side of history adds the file and the other side of history doesn't have the file.

In particular, for the cherry-picks or rebasing that Josef is doing going back to the root of history, that is simply doing merges against a side of history that hasn't modified any of his files, so there isn't going to be any automatic renormalization.

The rest of what you write about optimizations is spot on, though. This isn't a bug in cherry-pick (or merge or rebase); renormalizing all files proactively in the merge machinery whenever a merge or cherry-pick is done would be orders of magnitude slower for any decently sized repository; it's simply out of the question. I think Phillip's suggestion elsewhere in this thread (git rebase --root -x 'git add --renormalize . && { git diff --quiet --cached || git commit --amend --no-edit; }') would be what Josef needs to run, ASSUMING the history Josef is operating on is linear.

Hope that helps, Elijah

[1] Okay, technically renormalization is also used to turn modify/delete conflicts into simple deletes, when the only modification was a normalization of the file contents. I don't think that's relevant to Josef's case, though, so I elided it in the explanation.

Previous: Chris TorekNext: Josef Wolf
Message 13 of 44 in “renormalize histroy with smudge/clean-filter”
  1. Josef WolfFeb 5, 2025
  2. brian m. carlsonFeb 5, 2025
  3. Josef WolfFeb 5, 2025
  4. brian m. carlsonFeb 6, 2025
  5. Elijah NewrenFeb 6, 2025
  6. Josef WolfFeb 6, 2025
  7. Josef WolfFeb 6, 2025
  8. Chris TorekFeb 7, 2025
  9. Josef WolfFeb 7, 2025
  10. Torsten BögershausenFeb 7, 2025
  11. Chris TorekFeb 7, 2025
  12. Chris TorekFeb 7, 2025
  13. Elijah NewrenFeb 7, 2025
  14. Josef WolfFeb 7, 2025
  15. Elijah NewrenFeb 8, 2025
  16. Phillip WoodFeb 8, 2025
  17. Josef WolfFeb 8, 2025
  18. Elijah NewrenFeb 8, 2025
  19. Josef WolfFeb 8, 2025
  20. D. Ben KnobleFeb 9, 2025
  21. Josef WolfFeb 9, 2025
  22. Elijah NewrenFeb 9, 2025
  23. Josef WolfFeb 9, 2025
  24. D. Ben KnobleFeb 10, 2025
  25. Josef WolfFeb 8, 2025
  26. Elijah NewrenFeb 8, 2025
  27. Josef WolfFeb 9, 2025
  28. Torsten BögershausenFeb 9, 2025
  29. Josef WolfFeb 9, 2025
  30. Josef WolfFeb 9, 2025
  31. Josef WolfFeb 9, 2025
  32. Josef WolfFeb 7, 2025
  33. Junio C HamanoFeb 7, 2025
  34. Phillip WoodFeb 6, 2025
  35. Elijah NewrenFeb 6, 2025
  36. Junio C HamanoFeb 6, 2025
  37. Josef WolfFeb 11, 2025
  38. Torsten BögershausenFeb 12, 2025
  39. Josef WolfFeb 12, 2025
  40. Collisions while cloning (was: Re: renormalize histroy with smudge/clean-filter, again)Josef Wolf, Feb 13, 2025
  41. Torsten BögershausenFeb 13, 2025
  42. Josef WolfFeb 14, 2025
  43. brian m. carlsonFeb 14, 2025
  44. Josef WolfFeb 14, 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.