summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-06-16 16:14:22 -0700
committerJunio C Hamano <gitster@pobox.com>2008-06-16 16:14:22 -0700
commit9dc784a970ba5cc3871f7244c6bf6a823754f0a0 (patch)
treeecff10a922f352693b7411574b41898dfe16ae17 /diff.c
parent336d09daf288492946f0c51f071da11643f8363d (diff)
parent06ff64ae3d8c1d446ff61cff78a8faa3a07bfe24 (diff)
downloadgit-9dc784a970ba5cc3871f7244c6bf6a823754f0a0.tar.gz
Merge branch 'maint'
* maint: diff: reset color before printing newline
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 62fdc5492b..f23657bd34 100644
--- a/diff.c
+++ b/diff.c
@@ -514,9 +514,13 @@ const char *diff_get_color(int diff_use_color, enum color_diff ix)
static void emit_line(FILE *file, const char *set, const char *reset, const char *line, int len)
{
+ if (len > 0 && line[len-1] == '\n')
+ len--;
+
fputs(set, file);
fwrite(line, len, 1, file);
fputs(reset, file);
+ fputc('\n', file);
}
static void emit_add_line(const char *reset, struct emit_callback *ecbdata, const char *line, int len)