Skip to content

Commit a408e0e

Browse files
marcowsgitster
authored andcommitted
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>
1 parent be66a6c commit a408e0e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

diff.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -839,10 +839,9 @@ static int scale_linear(int it, int width, int max_change)
839839
}
840840

841841
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)
844843
{
845-
fprintf(file, " %s%s%-*s%s |", set, prefix, len, name, reset);
844+
fprintf(file, " %s%-*s |", prefix, len, name);
846845
}
847846

848847
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)
956955
}
957956

958957
if (data->files[i]->is_binary) {
959-
show_name(options->file, prefix, name, len, reset, set);
958+
show_name(options->file, prefix, name, len);
960959
fprintf(options->file, " Bin ");
961960
fprintf(options->file, "%s%d%s", del_c, deleted, reset);
962961
fprintf(options->file, " -> ");
@@ -966,7 +965,7 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
966965
continue;
967966
}
968967
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);
970969
fprintf(options->file, " Unmerged\n");
971970
continue;
972971
}
@@ -988,16 +987,16 @@ static void show_stats(struct diffstat_t* data, struct diff_options *options)
988987
add = scale_linear(add, width, max_change);
989988
del = scale_linear(del, width, max_change);
990989
}
991-
show_name(options->file, prefix, name, len, reset, set);
990+
show_name(options->file, prefix, name, len);
992991
fprintf(options->file, "%5d%s", added + deleted,
993992
added + deleted ? " " : "");
994993
show_graph(options->file, '+', add, add_c, reset);
995994
show_graph(options->file, '-', del, del_c, reset);
996995
fprintf(options->file, "\n");
997996
}
998997
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);
10011000
}
10021001

10031002
static void show_shortstats(struct diffstat_t* data, struct diff_options *options)

0 commit comments

Comments
 (0)