From 8c188c74e3f04ab75a42d43375a011f286cb1b66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Mon, 16 Apr 2012 03:44:49 -0700 Subject: t4052: test --stat output with --graph MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add tests which show that the width of the --prefix added by --graph is not taken into consideration when the diff stat output width is calculated. Signed-off-by: Zbigniew Jędrzejewski-Szmek Signed-off-by: Lucian Poston Signed-off-by: Junio C Hamano --- t/t4052-stat-output.sh | 78 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh index 328aa8f398..da14984585 100755 --- a/t/t4052-stat-output.sh +++ b/t/t4052-stat-output.sh @@ -82,11 +82,15 @@ test_expect_success 'preparation for big change tests' ' cat >expect80 <<'EOF' abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF - +cat >expect80-graph <<'EOF' +| abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +EOF cat >expect200 <<'EOF' abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF - +cat >expect200-graph <<'EOF' +| abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +EOF while read verb expect cmd args do test_expect_success "$cmd $verb COLUMNS (big change)" ' @@ -94,6 +98,14 @@ do grep " | " output >actual && test_cmp "$expect" actual ' + + test "$cmd" != diff || continue + + test_expect_success "$cmd --graph $verb COLUMNS (big change)" ' + COLUMNS=200 git $cmd $args --graph >output + grep " | " output >actual && + test_cmp "$expect-graph" actual + ' done <<\EOF ignores expect80 format-patch -1 --stdout respects expect200 diff HEAD^ HEAD --stat @@ -104,7 +116,9 @@ EOF cat >expect40 <<'EOF' abcd | 1000 ++++++++++++++++++++++++++ EOF - +cat >expect40-graph <<'EOF' +| abcd | 1000 ++++++++++++++++++++++++++ +EOF while read verb expect cmd args do test_expect_success "$cmd $verb not enough COLUMNS (big change)" ' @@ -118,6 +132,20 @@ do grep " | " output >actual && test_cmp "$expect" actual ' + + test "$cmd" != diff || continue + + test_expect_success "$cmd --graph $verb not enough COLUMNS (big change)" ' + COLUMNS=40 git $cmd $args --graph >output + grep " | " output >actual && + test_cmp "$expect-graph" actual + ' + + test_expect_success "$cmd --graph $verb statGraphWidth config" ' + git -c diff.statGraphWidth=26 $cmd $args --graph >output + grep " | " output >actual && + test_cmp "$expect-graph" actual + ' done <<\EOF ignores expect80 format-patch -1 --stdout respects expect40 diff HEAD^ HEAD --stat @@ -129,6 +157,9 @@ EOF cat >expect <<'EOF' abcd | 1000 ++++++++++++++++++++++++++ EOF +cat >expect-graph <<'EOF' +| abcd | 1000 ++++++++++++++++++++++++++ +EOF while read cmd args do test_expect_success "$cmd --stat=width with big change" ' @@ -143,11 +174,25 @@ do test_cmp expect actual ' - test_expect_success "$cmd --stat-graph--width with big change" ' + test_expect_success "$cmd --stat-graph-width with big change" ' git $cmd $args --stat-graph-width=26 >output grep " | " output >actual && test_cmp expect actual ' + + test "$cmd" != diff || continue + + test_expect_success "$cmd --stat-width=width --graph with big change" ' + git $cmd $args --stat-width=40 --graph >output + grep " | " output >actual && + test_cmp expect-graph actual + ' + + test_expect_success "$cmd --stat-graph-width --graph with big change" ' + git $cmd $args --stat-graph-width=26 --graph >output + grep " | " output >actual && + test_cmp expect-graph actual + ' done <<\EOF format-patch -1 --stdout diff HEAD^ HEAD --stat @@ -164,6 +209,9 @@ test_expect_success 'preparation for long filename tests' ' cat >expect <<'EOF' ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++ EOF +cat >expect-graph <<'EOF' +| ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++ +EOF while read cmd args do test_expect_success "$cmd --stat=width with big change is more balanced" ' @@ -171,6 +219,14 @@ do grep " | " output >actual && test_cmp expect actual ' + + test "$cmd" != diff || continue + + test_expect_success "$cmd --stat=width --graph with big change is balanced" ' + git $cmd $args --stat-width=60 --graph >output && + grep " | " output >actual && + test_cmp expect-graph actual + ' done <<\EOF format-patch -1 --stdout diff HEAD^ HEAD --stat @@ -181,9 +237,15 @@ EOF cat >expect80 <<'EOF' ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++ EOF +cat >expect80-graph <<'EOF' +| ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++ +EOF cat >expect200 <<'EOF' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF +cat >expect200-graph <<'EOF' +| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +EOF while read verb expect cmd args do test_expect_success "$cmd $verb COLUMNS (long filename)" ' @@ -191,6 +253,14 @@ do grep " | " output >actual && test_cmp "$expect" actual ' + + test "$cmd" != diff || continue + + test_expect_success "$cmd --graph $verb COLUMNS (long filename)" ' + COLUMNS=200 git $cmd $args --graph >output + grep " | " output >actual && + test_cmp "$expect-graph" actual + ' done <<\EOF ignores expect80 format-patch -1 --stdout respects expect200 diff HEAD^ HEAD --stat -- cgit v1.2.3 From 36dcc02c52cb60c751338591dbb3bf4d9cf5a753 Mon Sep 17 00:00:00 2001 From: Lucian Poston Date: Mon, 16 Apr 2012 03:44:52 -0700 Subject: t4052: Adjust --graph --stat output for prefixes Adjust tests to verify that the commit history graph tree is taken into consideration when the diff stat output width is calculated. Signed-off-by: Lucian Poston Signed-off-by: Junio C Hamano --- t/t4052-stat-output.sh | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 't') diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh index da14984585..d748e5e65c 100755 --- a/t/t4052-stat-output.sh +++ b/t/t4052-stat-output.sh @@ -89,7 +89,7 @@ cat >expect200 <<'EOF' abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF cat >expect200-graph <<'EOF' -| abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +| abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF while read verb expect cmd args do @@ -117,7 +117,7 @@ cat >expect40 <<'EOF' abcd | 1000 ++++++++++++++++++++++++++ EOF cat >expect40-graph <<'EOF' -| abcd | 1000 ++++++++++++++++++++++++++ +| abcd | 1000 ++++++++++++++++++++++++ EOF while read verb expect cmd args do @@ -127,12 +127,6 @@ do test_cmp "$expect" actual ' - test_expect_success "$cmd $verb statGraphWidth config" ' - git -c diff.statGraphWidth=26 $cmd $args >output - grep " | " output >actual && - test_cmp "$expect" actual - ' - test "$cmd" != diff || continue test_expect_success "$cmd --graph $verb not enough COLUMNS (big change)" ' @@ -140,6 +134,28 @@ do grep " | " output >actual && test_cmp "$expect-graph" actual ' +done <<\EOF +ignores expect80 format-patch -1 --stdout +respects expect40 diff HEAD^ HEAD --stat +respects expect40 show --stat +respects expect40 log -1 --stat +EOF + +cat >expect40 <<'EOF' + abcd | 1000 ++++++++++++++++++++++++++ +EOF +cat >expect40-graph <<'EOF' +| abcd | 1000 ++++++++++++++++++++++++++ +EOF +while read verb expect cmd args +do + test_expect_success "$cmd $verb statGraphWidth config" ' + git -c diff.statGraphWidth=26 $cmd $args >output + grep " | " output >actual && + test_cmp "$expect" actual + ' + + test "$cmd" != diff || continue test_expect_success "$cmd --graph $verb statGraphWidth config" ' git -c diff.statGraphWidth=26 $cmd $args --graph >output @@ -244,7 +260,7 @@ cat >expect200 <<'EOF' aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF cat >expect200-graph <<'EOF' -| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +| aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF while read verb expect cmd args do -- cgit v1.2.3 From da79161db6dcb0643ab805e5cf78d7e4e34ce993 Mon Sep 17 00:00:00 2001 From: Lucian Poston Date: Wed, 18 Apr 2012 14:09:33 -0700 Subject: t4052: Test diff-stat output with minimum columns When COLUMNS or --stat-width restricts the diff-stat width to near the minimum, 26 columns, the graph_width value becomes negative. Consequently, the graph part of diff-stat is not resized properly. Signed-off-by: Lucian Poston Signed-off-by: Junio C Hamano --- t/t4052-stat-output.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 't') diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh index d748e5e65c..b8eec8fd26 100755 --- a/t/t4052-stat-output.sh +++ b/t/t4052-stat-output.sh @@ -284,6 +284,34 @@ respects expect200 show --stat respects expect200 log -1 --stat EOF +cat >expect1 <<'EOF' + ...aaaaaaa | 1000 ++++++ +EOF +cat >expect1-graph <<'EOF' +| ...aaaaaaa | 1000 ++++++ +EOF +while read teststate verb expect cmd args +do + test_expect_$teststate "$cmd $verb prefix greater than COLUMNS (big change)" ' + COLUMNS=1 git $cmd $args >output + grep " | " output >actual && + test_cmp "$expect" actual + ' + + test "$cmd" != diff || continue + + test_expect_$teststate "$cmd --graph $verb prefix greater than COLUMNS (big change)" ' + COLUMNS=1 git $cmd $args --graph >output + grep " | " output >actual && + test_cmp "$expect-graph" actual + ' +done <<\EOF +success ignores expect80 format-patch -1 --stdout +failure respects expect1 diff HEAD^ HEAD --stat +failure respects expect1 show --stat +failure respects expect1 log -1 --stat +EOF + cat >expect <<'EOF' abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ EOF -- cgit v1.2.3 From 678c5741118729dc9072182bd368e0a3402dd4f1 Mon Sep 17 00:00:00 2001 From: Lucian Poston Date: Wed, 18 Apr 2012 14:12:18 -0700 Subject: Prevent graph_width of stat width from falling below min Update tests in t4052 fixed by this change. Signed-off-by: Lucian Poston Signed-off-by: Junio C Hamano --- t/t4052-stat-output.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 't') diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh index b8eec8fd26..ced32dbbca 100755 --- a/t/t4052-stat-output.sh +++ b/t/t4052-stat-output.sh @@ -290,9 +290,9 @@ EOF cat >expect1-graph <<'EOF' | ...aaaaaaa | 1000 ++++++ EOF -while read teststate verb expect cmd args +while read verb expect cmd args do - test_expect_$teststate "$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,16 +300,16 @@ do test "$cmd" != diff || continue - test_expect_$teststate "$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 ' done <<\EOF -success ignores expect80 format-patch -1 --stdout -failure respects expect1 diff HEAD^ HEAD --stat -failure respects expect1 show --stat -failure respects expect1 log -1 --stat +ignores expect80 format-patch -1 --stdout +respects expect1 diff HEAD^ HEAD --stat +respects expect1 show --stat +respects expect1 log -1 --stat EOF cat >expect <<'EOF' -- cgit v1.2.3 From bafa16e53c8845f3d3b7713dcbef8a5c841cadad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 27 Apr 2012 11:25:25 +0200 Subject: t4052: work around shells unable to set COLUMNS to 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Zbigniew Jędrzejewski-Szmek Signed-off-by: Junio C Hamano --- t/t4052-stat-output.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh index ced32dbbca..ddd94976c2 100755 --- a/t/t4052-stat-output.sh +++ b/t/t4052-stat-output.sh @@ -292,7 +292,8 @@ cat >expect1-graph <<'EOF' EOF while read verb expect cmd args do - test_expect_success "$cmd $verb prefix greater than COLUMNS (big change)" ' + test_expect_success COLUMNS_CAN_BE_1 \ + "$cmd $verb prefix greater than COLUMNS (big change)" ' COLUMNS=1 git $cmd $args >output grep " | " output >actual && test_cmp "$expect" actual @@ -300,7 +301,8 @@ do test "$cmd" != diff || continue - test_expect_success "$cmd --graph $verb prefix greater than COLUMNS (big change)" ' + test_expect_success COLUMNS_CAN_BE_1 \ + "$cmd --graph $verb prefix greater than COLUMNS (big change)" ' COLUMNS=1 git $cmd $args --graph >output grep " | " output >actual && test_cmp "$expect-graph" actual -- cgit v1.2.3