diff.c: omit hidden entries from namelen calculation with --stat
Currently, --stat calculates the longest name from all items but then drops some (mode changes) from the output later on. Instead, drop them from the namelen generation and calculation. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
0b9deecf62
commit
358e460eeb
14
diff.c
14
diff.c
@ -1278,6 +1278,10 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
|
|||||||
for (i = 0; i < data->nr; i++) {
|
for (i = 0; i < data->nr; i++) {
|
||||||
struct diffstat_file *file = data->files[i];
|
struct diffstat_file *file = data->files[i];
|
||||||
uintmax_t change = file->added + file->deleted;
|
uintmax_t change = file->added + file->deleted;
|
||||||
|
if (!data->files[i]->is_renamed &&
|
||||||
|
(change == 0)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
fill_print_name(file);
|
fill_print_name(file);
|
||||||
len = strlen(file->print_name);
|
len = strlen(file->print_name);
|
||||||
if (max_len < len)
|
if (max_len < len)
|
||||||
@ -1309,6 +1313,11 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
|
|||||||
uintmax_t deleted = data->files[i]->deleted;
|
uintmax_t deleted = data->files[i]->deleted;
|
||||||
int name_len;
|
int name_len;
|
||||||
|
|
||||||
|
if (!data->files[i]->is_renamed &&
|
||||||
|
(added + deleted == 0)) {
|
||||||
|
total_files--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* "scale" the filename
|
* "scale" the filename
|
||||||
*/
|
*/
|
||||||
@ -1343,11 +1352,6 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
|
|||||||
fprintf(options->file, " Unmerged\n");
|
fprintf(options->file, " Unmerged\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!data->files[i]->is_renamed &&
|
|
||||||
(added + deleted == 0)) {
|
|
||||||
total_files--;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* scale the add/delete
|
* scale the add/delete
|
||||||
|
Loading…
x
Reference in New Issue
Block a user