Revision 06ff64ae3d8c1d446ff61cff78a8faa3a07bfe24 authored by SZEDER Gábor on 16 June 2008, 22:00:02 UTC, committed by Junio C Hamano on 16 June 2008, 22:22:09 UTC
It worked that way since commit 50f575fc (Tweak diff colors,
2006-06-22), but commit c1795bb0 (Unify whitespace checking, 2007-12-13)
changed it.  This patch restores the old behaviour.

Besides Linus' arguments in the log message of 50f575fc, resetting color
before printing newline is also important to keep 'git add --patch'
happy.  If the last line(s) of a file are removed, then that hunk will
end with a colored line.  However, if the newline comes before the color
reset, then the diff output will have an additional line at the end
containing only the reset sequence.  This causes trouble in
git-add--interactive.perl's parse_diff function, because @colored will
have one more element than @diff, and that last element will contain the
color reset.  The elements of these arrays will then be copied to @hunk,
but only as many as the number of elements in @diff.  As a result the
last color reset is lost and all subsequent terminal output will be
printed in color.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 2feaf4e
History
File Mode Size
fopen.c -rw-r--r-- 401 bytes
hstrerror.c -rw-r--r-- 513 bytes
inet_ntop.c -rw-r--r-- 4.9 KB
inet_pton.c -rw-r--r-- 6.9 KB
memmem.c -rw-r--r-- 668 bytes
mkdtemp.c -rw-r--r-- 152 bytes
mmap.c -rw-r--r-- 747 bytes
pread.c -rw-r--r-- 433 bytes
qsort.c -rw-r--r-- 1.1 KB
setenv.c -rw-r--r-- 786 bytes
snprintf.c -rw-r--r-- 644 bytes
strcasestr.c -rw-r--r-- 431 bytes
strlcpy.c -rw-r--r-- 247 bytes
strtoumax.c -rw-r--r-- 217 bytes
unsetenv.c -rw-r--r-- 558 bytes

back to top