]> git.ipfire.org Git - thirdparty/git.git/commit - git-add--interactive.perl
Teach "git add -i" to colorize whitespace errors
authorWincent Colaiuta <win@wincent.com>
Fri, 7 Dec 2007 12:35:10 +0000 (13:35 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 8 Dec 2007 10:53:19 +0000 (02:53 -0800)
commit4af756f31b0696ed1ca6ad10dc6d7053477edc16
treef95f0781c3090151b73b4d18b3284898c9934492
parent8e566f24b369836c43d720e4246a152b0e7724c6
Teach "git add -i" to colorize whitespace errors

Rather than replicating the colorization logic of "git diff-files" we
rely on "git diff-files" itself. This guarantees consistent colorization
in and outside "git add -i".

Seeing as speed is not a concern here (the bottleneck is how fast the
user can read, not how fast "git diff-files" runs) we do this by
actually running it twice, once without color and once with.

In this way as the whitespace colorization provided by "git diff-files"
evolves (per-path attributes, new classes of whitespace error), "git
add -i" will automatically benefit from it and stay in synch.

Also, by working with two sets of diff output (an uncolorized one for
internal processing and a colorized one for display only) we minimize
the risk of regressions because the changes required to implement this
are minimally invasive.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-add--interactive.perl