diff: correct diff stat alignment in presence of renames w/ common prefix. by kivikakk · Pull Request #7057 · libgit2/libgit2
Hi old friends!
I noticed that libgit2's diff stat has its alignment get thrown out in the presence of renames where there's a common prefix, e.g.:
lib/nos_web/controllers/user_controller.ex | 7 ++++++-
lib/nos_web/controllers/{page_html.ex => user_html.ex} | 8 ++-----
lib/nos_web/controllers/user_html/show.html.heex | 3 +++-
This PR adds a test for this (fails on main), and then fixes it by reproducing the common prefix detection when calculating git_diff_stats's max_name member. That now fully accounts for the various formats (i.e. samename, oldname => newname, prefix{oldsuffix => newsuffix}).
This removed the sole use of renames in the same struct, so I dropped it.