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

[PATCH v4 4/4] Prevent graph_width of stat width from falling below min

From
Lucian Poston <lucian.poston@gmail.com>
Date
Apr 18, 2012, 02:29 UTC
Message-ID
<1334716196-9870-4-git-send-email-lucian.poston@gmail.com>
In-Reply-To
<1334716196-9870-1-git-send-email-lucian.poston@gmail.com>
Update tests in t4052 fixed by this change.
Signed-off-by: Lucian Poston <lucian.poston@gmail.com>
---
 diff.c                 |    6 +++++-
 t/t4052-stat-output.sh |    4 ++--
 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/diff.c b/diff.c
index 0b61cf7..f08b41a 100644
--- a/diff.c
+++ b/diff.c
@@ -1473,8 +1473,12 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
 	 * Adjust adjustable widths not to exceed maximum width
 	 */
 	if (name_width + number_width + 6 + graph_width > width) {
-		if (graph_width > width * 3/8 - number_width - 6)
+		if (graph_width > width * 3/8 - number_width - 6) {
 			graph_width = width * 3/8 - number_width - 6;
+			if (graph_width < 6)
+				graph_width = 6;
+		}
+
 		if (options->stat_graph_width &&
 		    graph_width > options->stat_graph_width)
 			graph_width = options->stat_graph_width;
diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh
index 6305c99..ced32db 100755
--- a/t/t4052-stat-output.sh
+++ b/t/t4052-stat-output.sh
@@ -292,7 +292,7 @@ cat >expect1-graph <<'EOF'
 EOF
 while read verb expect cmd args
 do
-	test_expect_failure "$cmd $verb prefix greater than COLUMNS (big change)" '
+	test_expect_success "$cmd $verb prefix greater than COLUMNS (big change)" '
 		COLUMNS=1 git $cmd $args >output
 		grep " | " output >actual &&
 		test_cmp "$expect" actual
@@ -300,7 +300,7 @@ do
 
 	test "$cmd" != diff || continue
 
-	test_expect_failure "$cmd --graph $verb prefix greater than COLUMNS (big change)" '
+	test_expect_success "$cmd --graph $verb prefix greater than COLUMNS (big change)" '
 		COLUMNS=1 git $cmd $args --graph >output
 		grep " | " output >actual &&
 		test_cmp "$expect-graph" actual
-- 
1.7.3.4
Previous: Junio C HamanoNext: Lucian Poston
Message 15 of 17 in “t4052: test --stat output with --graph”
  1. 1/4 t4052: test --stat output with --graphLucian Poston, Apr 18, 2012
  2. 2/4 Adjust stat width calculations to take --graph output into accountLucian Poston, Apr 18, 2012
  3. 3/4 t4052: Test diff-stat output with minimum columnsLucian Poston, Apr 18, 2012
  4. Junio C HamanoApr 18, 2012
  5. Lucian PostonApr 18, 2012
  6. Lucian PostonApr 18, 2012
  7. Kacper KornetApr 26, 2012
  8. test: skip test with COLUMNS=1 under mkshZbigniew Jędrzejewski-Szmek, Apr 27, 2012
  9. Junio C HamanoApr 27, 2012
  10. Zbigniew Jędrzejewski-SzmekApr 28, 2012
  11. Junio C HamanoApr 27, 2012
  12. Stefano LattariniApr 27, 2012
  13. Zbigniew Jędrzejewski-SzmekApr 28, 2012
  14. Junio C HamanoApr 29, 2012
  15. 4/4 Prevent graph_width of stat width from falling below minLucian Poston, Apr 18, 2012
  16. Lucian PostonApr 18, 2012
  17. Zbigniew Jędrzejewski-SzmekApr 18, 2012

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.