Subject: [GSoC PATCH 0/2] diff: handle ANSI chars in prefix when calculating diffstat width

From: LorenzoPegorari <[email-masked]>
Date: Tue, 24 Feb 2026 02:09:46 +0100

This patch aims to fix a bug where the calculation of the diffstat width
incorrectly uses the strlen() of line_prefix instead of its actual
display width.

This patch addresses the NEEDSWORK item added by ce8529b2 (diff: leave
NEEDWORK notes in show_stats() function, 2022-10-21).

Also, this bug was reported and suggested to me by Junio C Hamano here:
https://lore.kernel.org/git/[email-masked]/

Junio, do you wish to be included in this patch by a Reported-by and/or
Suggested-by tag?

LorenzoPegorari (2):
  diff: handle ANSI chars in prefix when calculating diffstat width
  t4074: add test for diffstat width when prefix contains ANSI chars

 diff.c                                      | 12 ++----
 t/t4074-diff-stat-width-with-line-prefix.sh | 42 +++++++++++++++++++++
 2 files changed, 46 insertions(+), 8 deletions(-)
 create mode 100755 t/t4074-diff-stat-width-with-line-prefix.sh

-- 
2.43.0