diff: do not color --stat output like patch context
The diffstat used the color.diff.plain slot (context text) for coloring filenames and the whole summary line. This didn't look nice and the affected text isn't patch context at all. Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Markus Heidelberg committed
Apr 25, 2009 at 00:06 UTC
a408e0e649b79ede7422bf837a31d281e4188cef
1 file changed
+7
-8
diff.c
+7
-8
@@ -839,10 +839,9 @@ static int scale_linear(int it, int width, int max_change)
839
}
840
841
static void show_name(FILE *file,
842
- const char *prefix, const char *name, int len,
843
- const char *reset, const char *set)
842
+ const char *prefix, const char *name, int len)
843
{
845
- fprintf(file, " %s%s%-*s%s |", set, prefix, len, name, reset);
844
+ fprintf(file, " %s%-*s |", prefix, len, name);
845
}
846
847
static void show_graph(FILE *file, char ch, int cnt, const char *set, const char *reset)
@@ -956,7 +955,7 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
955
}
956
957
if (data->files[i]->is_binary) {
959
- show_name(options->file, prefix, name, len, reset, set);
958
+ show_name(options->file, prefix, name, len);
959
fprintf(options->file, " Bin ");
960
fprintf(options->file, "%s%d%s", del_c, deleted, reset);
961
fprintf(options->file, " -> ");
@@ -966,7 +965,7 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
965
continue;
966
}
967
else if (data->files[i]->is_unmerged) {
969
- show_name(options->file, prefix, name, len, reset, set);
968
+ show_name(options->file, prefix, name, len);
969
fprintf(options->file, " Unmerged\n");
970
continue;
971
}
@@ -988,7 +987,7 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
987
add = scale_linear(add, width, max_change);
988
del = scale_linear(del, width, max_change);
989
}
991
- show_name(options->file, prefix, name, len, reset, set);
990
+ show_name(options->file, prefix, name, len);
991
fprintf(options->file, "%5d%s", added + deleted,
992
added + deleted ? " " : "");
993
show_graph(options->file, '+', add, add_c, reset);
@@ -996,8 +995,8 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
995
fprintf(options->file, "\n");
996
}
997
fprintf(options->file,
999
- "%s %d files changed, %d insertions(+), %d deletions(-)%s\n",
1000
- set, total_files, adds, dels, reset);
998
+ " %d files changed, %d insertions(+), %d deletions(-)\n",
999
+ total_files, adds, dels);
1000
}
1001
1002
static void show_shortstats(struct diffstat_t* data, struct diff_options *options)