git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] diff- family --stat: use the full terminal width

From
Thomas Koutcher via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 21, 2022, 20:15 UTC
Message-ID
<c591e50ebb4593f9716c8e7682ecdecdb6fb5ae1.1650572159.git.gitgitgadget@gmail.com>
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 behave like diff --stat and use the full terminal width.

Signed-off-by: Thomas Koutcher <thomas.koutcher@online.fr>
---
 builtin/diff-files.c | 1 +
 builtin/diff-index.c | 1 +
 builtin/diff-tree.c  | 1 +
 3 files changed, 3 insertions(+)
diff --git a/builtin/diff-files.c b/builtin/diff-files.c
index 70103c40952..2265cd256be 100644
--- a/builtin/diff-files.c
+++ b/builtin/diff-files.c
@@ -29,6 +29,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
 	repo_init_revisions(the_repository, &rev, prefix);
 	rev.abbrev = 0;
+	rev.diffopt.stat_width = -1; /* use full terminal width */
 
 	/*
 	 * Consider "intent-to-add" files as new by default, unless
diff --git a/builtin/diff-index.c b/builtin/diff-index.c
index 5fd23ab5b6c..9cb9555fdeb 100644
--- a/builtin/diff-index.c
+++ b/builtin/diff-index.c
@@ -26,6 +26,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
 	repo_init_revisions(the_repository, &rev, prefix);
 	rev.abbrev = 0;
+	rev.diffopt.stat_width = -1; /* use full terminal width */
 	prefix = precompose_argv_prefix(argc, argv, prefix);
 
 	/*
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 0e0ac1f1670..4a2a2744fae 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -122,6 +122,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
 		die(_("index file corrupt"));
 	opt->abbrev = 0;
 	opt->diff = 1;
+	opt->diffopt.stat_width = -1; /* use full terminal width */
 	opt->disable_stdin = 1;
 	memset(&s_r_opt, 0, sizeof(s_r_opt));
 	s_r_opt.tweak = diff_tree_tweak_rev;
-- 
gitgitgadget
Previous: Thomas Koutcher via GitGitGadgetNext: Thomas Koutcher via GitGitGadget
Message 2 of 5 in “diff- family --stat width”
  1. 0/2 diff- family --stat widthThomas Koutcher via GitGitGadget, Apr 21, 2022
  2. 1/2 diff- family --stat: use the full terminal widthThomas Koutcher via GitGitGadget, Apr 21, 2022
  3. 2/2 diff- family --stat: honour config option to limit graph widthThomas Koutcher via GitGitGadget, Apr 21, 2022
  4. Junio C HamanoApr 21, 2022
  5. Thomas KoutcherApr 29, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.