Thread (14 messages) 14 messages, 7 authors, 2025-12-20

Re: [PATCH] diff: add --no-indicators option

From: Collin Funk <hidden>
Date: 2025-12-19 08:57:10

"Harald Nordgren via GitGitGadget" [off-list ref] writes:
From: Harald Nordgren <redacted>

Add --no-indicators to replace '+', '-', and ' ' indicators in the
left margin with spaces. Colors are preserved, allowing diffs to be
distinguished by color alone.

This is useful when copy-pasting diff output, as the indicators no
longer need to be manually removed.

Signed-off-by: Harald Nordgren <redacted>
---
    diff: add '--no-indicators' option

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2133%2FHaraldNordgren%2Fno-indicators-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2133/HaraldNordgren/no-indicators-v1
Pull-Request: https://github.com/git/git/pull/2133

 diff.c                 | 17 +++++++++++++++++
 t/t4000-diff-format.sh | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)
Would a 'sed' command work for this? Something like:

    $ git diff --color=always HEAD~ \
        | sed -E '/^(\x1b\[[0-9;]*m)*(-{3} a|\+{3} b)/b
                  s/^((\x1b\[[0-9;]*m)*)[-+]/\1 /'

My impression is that indicators are wanted for diff's most (all?) of
the time.

Collin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help