[PATCH 3/4] diff --stat: use the real terminal width
From: Zbigniew Jędrzejewski-Szmek <hidden>
Date: 2016-06-15 22:53:02
Subsystem:
the rest · Maintainer:
Linus Torvalds
Some projects (especially in Java), have long filename paths, with
nested directories or long individual filenames. When files are
renamed, the stat output can be almost useless. If the middle part
between { and } is long (because the file was moved to a completely
different directory), then most of the path would be truncated.
It makes sense to use the full terminal width.
The output is still not optimal, because too many columns are devoted
to +- output, and not enough to filenames, but this is a policy
question, changed in next commit.
Signed-off-by: Zbigniew Jędrzejewski-Szmek <redacted>
---
diff.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/diff.c b/diff.c
index 7e15426..8406a0d 100644
--- a/diff.c
+++ b/diff.c@@ -7,6 +7,7 @@ #include "diffcore.h" #include "delta.h" #include "xdiff-interface.h" +#include "help.h" #include "color.h" #include "attr.h" #include "run-command.h"
@@ -1341,7 +1342,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options) line_prefix = msg->buf; } - width = options->stat_width ? options->stat_width : 80; + width = options->stat_width ? options->stat_width : term_columns(); name_width = options->stat_name_width ? options->stat_name_width : 50; count = options->stat_count ? options->stat_count : data->nr;
--
1.7.9.rc2.127.gcb239