diff options
author | Dragan Simic <dsimic@manjaro.org> | 2023-09-23 07:01:14 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-09-30 01:46:06 +0300 |
commit | 4ca7a3fd26d0c6214f46f2413c5ba8ed346fea1a (patch) | |
tree | 95465fb5a6b478a683f8dffd9fae8940415680de /diff.c | |
parent | 493f4622739e9b64f24b465b21aa85870dd9dc09 (diff) |
diff --stat: set the width defaults in a helper function
Extract the commonly used initialization of the --stat-width=<width>,
--stat-name-width=<width> and --stat-graph-with=<width> parameters to their
internal default values into a helper function, to avoid repeating the same
initialization code in a few places.
Add a couple of tests to additionally cover existing configuration options
diff.statNameWidth=<width> and diff.statGraphWidth=<width> when used by
git-merge to generate --stat outputs. This closes the gap that existed
previously in the --stat tests, and reduces the chances for having any
regressions introduced by this commit.
While there, perform a small bunch of minor wording tweaks in the improved
unit test, to improve its test-level consistency a bit.
Signed-off-by: Dragan Simic <dsimic@manjaro.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r-- | diff.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -6936,6 +6936,13 @@ void diff_queued_diff_prefetch(void *repository) oid_array_clear(&to_fetch); } +void init_diffstat_widths(struct diff_options *options) +{ + options->stat_width = -1; /* use full terminal width */ + options->stat_name_width = -1; /* respect diff.statNameWidth config */ + options->stat_graph_width = -1; /* respect diff.statGraphWidth config */ +} + void diffcore_std(struct diff_options *options) { int output_formats_to_prefetch = DIFF_FORMAT_DIFFSTAT | |