Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
diff: reset color before printing newline
It worked that way since commit 50f575f (Tweak diff colors, 2006-06-22), but commit c1795bb (Unify whitespace checking, 2007-12-13) changed it. This patch restores the old behaviour. Besides Linus' arguments in the log message of 50f575f, 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>
- Loading branch information