From: "Thomas Koutcher via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Thomas Koutcher <thomas.koutcher@online.fr>,
Thomas Koutcher <thomas.koutcher@online.fr>
Subject: [PATCH 2/2] diff- family --stat: honour config option to limit graph width
Date: Thu, 21 Apr 2022 20:15:59 +0000 [thread overview]
Message-ID: <94acd9e0a47fcbee91f7759d1556d39fec26dd2d.1650572159.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1256.git.git.1650572159.gitgitgadget@gmail.com>
From: Thomas Koutcher <thomas.koutcher@online.fr>
Make diff-files, diff-index and diff-tree --stat honour config option
diff.statGraphWidth as, according to git-config(1), it applies to all
commands generating --stat output except format-patch.
Move the parsing of diff.statgraphwidth from git_diff_ui_config() to
git_diff_basic_config() to make it accessible to all commands.
Signed-off-by: Thomas Koutcher <thomas.koutcher@online.fr>
---
builtin/diff-files.c | 1 +
builtin/diff-index.c | 1 +
builtin/diff-tree.c | 1 +
diff.c | 9 +++++----
4 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/builtin/diff-files.c b/builtin/diff-files.c
index 2265cd256be..e9b96278434 100644
--- a/builtin/diff-files.c
+++ b/builtin/diff-files.c
@@ -30,6 +30,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
repo_init_revisions(the_repository, &rev, prefix);
rev.abbrev = 0;
rev.diffopt.stat_width = -1; /* use full terminal width */
+ rev.diffopt.stat_graph_width = -1; /* respect statGraphWidth config */
/*
* Consider "intent-to-add" files as new by default, unless
diff --git a/builtin/diff-index.c b/builtin/diff-index.c
index 9cb9555fdeb..10f78180264 100644
--- a/builtin/diff-index.c
+++ b/builtin/diff-index.c
@@ -27,6 +27,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
repo_init_revisions(the_repository, &rev, prefix);
rev.abbrev = 0;
rev.diffopt.stat_width = -1; /* use full terminal width */
+ rev.diffopt.stat_graph_width = -1; /* respect statGraphWidth config */
prefix = precompose_argv_prefix(argc, argv, prefix);
/*
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 4a2a2744fae..0b783dcbc44 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -123,6 +123,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
opt->abbrev = 0;
opt->diff = 1;
opt->diffopt.stat_width = -1; /* use full terminal width */
+ opt->diffopt.stat_graph_width = -1; /* respect statGraphWidth config */
opt->disable_stdin = 1;
memset(&s_r_opt, 0, sizeof(s_r_opt));
s_r_opt.tweak = diff_tree_tweak_rev;
diff --git a/diff.c b/diff.c
index ef7159968b6..0923a25d5bb 100644
--- a/diff.c
+++ b/diff.c
@@ -394,10 +394,6 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
diff_relative = git_config_bool(var, value);
return 0;
}
- if (!strcmp(var, "diff.statgraphwidth")) {
- diff_stat_graph_width = git_config_int(var, value);
- return 0;
- }
if (!strcmp(var, "diff.external"))
return git_config_string(&external_diff_cmd_cfg, var, value);
if (!strcmp(var, "diff.wordregex"))
@@ -477,6 +473,11 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
return 0;
}
+ if (!strcmp(var, "diff.statgraphwidth")) {
+ diff_stat_graph_width = git_config_int(var, value);
+ return 0;
+ }
+
if (git_diff_heuristic_config(var, value, cb) < 0)
return -1;
--
gitgitgadget
next prev parent reply other threads:[~2022-04-21 20:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 20:15 [PATCH 0/2] diff- family --stat width Thomas Koutcher via GitGitGadget
2022-04-21 20:15 ` [PATCH 1/2] diff- family --stat: use the full terminal width Thomas Koutcher via GitGitGadget
2022-04-21 20:15 ` Thomas Koutcher via GitGitGadget [this message]
2022-04-21 21:33 ` [PATCH 0/2] diff- family --stat width Junio C Hamano
2022-04-29 17:22 ` Thomas Koutcher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=94acd9e0a47fcbee91f7759d1556d39fec26dd2d.1650572159.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=thomas.koutcher@online.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).