diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-10-10 11:39:14 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-10-10 11:39:14 -0700 |
| commit | afb0d0880abb56d8084f1fac704e17f82d491bc9 (patch) | |
| tree | 943c3329bbd441a1666f4d9416a168eee1402e56 /builtin | |
| parent | a7a2d10421b735944f376f1de53b437bfbb93e88 (diff) | |
| parent | 4ca7a3fd26d0c6214f46f2413c5ba8ed346fea1a (diff) | |
| download | git-afb0d0880abb56d8084f1fac704e17f82d491bc9.tar.xz | |
Merge branch 'ds/init-diffstat-width'
Code clean-up.
* ds/init-diffstat-width:
diff --stat: set the width defaults in a helper function
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/diff.c | 4 | ||||
| -rw-r--r-- | builtin/log.c | 6 | ||||
| -rw-r--r-- | builtin/merge.c | 4 | ||||
| -rw-r--r-- | builtin/rebase.c | 4 |
4 files changed, 5 insertions, 13 deletions
diff --git a/builtin/diff.c b/builtin/diff.c index c0f564273a..55e7d21755 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -474,9 +474,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix) repo_init_revisions(the_repository, &rev, prefix); /* Set up defaults that will apply to both no-index and regular diffs. */ - rev.diffopt.stat_width = -1; - rev.diffopt.stat_name_width = -1; - rev.diffopt.stat_graph_width = -1; + init_diffstat_widths(&rev.diffopt); rev.diffopt.flags.allow_external = 1; rev.diffopt.flags.allow_textconv = 1; diff --git a/builtin/log.c b/builtin/log.c index 80e1be1645..ba775d7b5c 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -176,17 +176,15 @@ static void cmd_log_init_defaults(struct rev_info *rev) if (default_follow) rev->diffopt.flags.default_follow_renames = 1; rev->verbose_header = 1; + init_diffstat_widths(&rev->diffopt); rev->diffopt.flags.recursive = 1; - rev->diffopt.stat_width = -1; /* use full terminal width */ - rev->diffopt.stat_name_width = -1; /* respect statNameWidth config */ - rev->diffopt.stat_graph_width = -1; /* respect statGraphWidth config */ + rev->diffopt.flags.allow_textconv = 1; rev->abbrev_commit = default_abbrev_commit; rev->show_root_diff = default_show_root; rev->subject_prefix = fmt_patch_subject_prefix; rev->patch_name_max = fmt_patch_name_max; rev->show_signature = default_show_signature; rev->encode_email_headers = default_encode_email_headers; - rev->diffopt.flags.allow_textconv = 1; if (default_date_mode) parse_date_format(default_date_mode, &rev->date_mode); diff --git a/builtin/merge.c b/builtin/merge.c index fd21c0d4f4..8f397cbeff 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -466,9 +466,7 @@ static void finish(struct commit *head_commit, if (new_head && show_diffstat) { struct diff_options opts; repo_diff_setup(the_repository, &opts); - opts.stat_width = -1; /* use full terminal width */ - opts.stat_name_width = -1; /* respect statNameWidth config */ - opts.stat_graph_width = -1; /* respect statGraphWidth config */ + init_diffstat_widths(&opts); opts.output_format |= DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT; opts.detect_rename = DIFF_DETECT_RENAME; diff --git a/builtin/rebase.c b/builtin/rebase.c index ed15accec9..f990811614 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1803,9 +1803,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) /* We want color (if set), but no pager */ repo_diff_setup(the_repository, &opts); - opts.stat_width = -1; /* use full terminal width */ - opts.stat_name_width = -1; /* respect statNameWidth config */ - opts.stat_graph_width = -1; /* respect statGraphWidth config */ + init_diffstat_widths(&opts); opts.output_format |= DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT; opts.detect_rename = DIFF_DETECT_RENAME; |
