Code

Merge v1.7.10-rc0 for git l10n update
[git.git] / t / t4052-stat-output.sh
index f766c4768227b94077c786a5403498bd25c2d18e..328aa8f39865fb90d4b54991f158affa9cf2e1dc 100755 (executable)
@@ -22,18 +22,18 @@ test_expect_success 'preparation' '
 while read cmd args
 do
        cat >expect <<-'EOF'
-        ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
+        ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
        EOF
-       test_expect_success "$cmd: a short graph bar does not extend to the full width" '
+       test_expect_success "$cmd: small change with long name gives more space to the name" '
                git $cmd $args >output &&
                grep " | " output >actual &&
                test_cmp expect actual
        '
 
        cat >expect <<-'EOF'
-        ...aaaaaaaaaaaaaaaaaaaaaa |    1 +
+        ...aaaaaaaaaaaaaaaaaaaaaaaaaa |    1 +
        EOF
-       test_expect_success "$cmd --stat=width: name is chopped to leave room to the right of a short bar" '
+       test_expect_success "$cmd --stat=width: a long name is given more room when the bar is short" '
                git $cmd $args --stat=40 >output &&
                grep " | " output >actual &&
                test_cmp expect actual
@@ -83,6 +83,10 @@ cat >expect80 <<'EOF'
  abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 EOF
 
+cat >expect200 <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+EOF
+
 while read verb expect cmd args
 do
        test_expect_success "$cmd $verb COLUMNS (big change)" '
@@ -92,11 +96,36 @@ do
        '
 done <<\EOF
 ignores expect80 format-patch -1 --stdout
-ignores expect80 diff HEAD^ HEAD --stat
-ignores expect80 show --stat
-ignores expect80 log -1 --stat
+respects expect200 diff HEAD^ HEAD --stat
+respects expect200 show --stat
+respects expect200 log -1 --stat
+EOF
+
+cat >expect40 <<'EOF'
+ abcd | 1000 ++++++++++++++++++++++++++
+EOF
+
+while read verb expect cmd args
+do
+       test_expect_success "$cmd $verb not enough COLUMNS (big change)" '
+               COLUMNS=40 git $cmd $args >output
+               grep " | " output >actual &&
+               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
+       '
+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 >expect <<'EOF'
  abcd | 1000 ++++++++++++++++++++++++++
 EOF
@@ -113,6 +142,12 @@ do
                grep " | " output >actual &&
                test_cmp expect actual
        '
+
+       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
+       '
 done <<\EOF
 format-patch -1 --stdout
 diff HEAD^ HEAD --stat
@@ -127,11 +162,11 @@ test_expect_success 'preparation for long filename tests' '
 '
 
 cat >expect <<'EOF'
- ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++
 EOF
 while read cmd args
 do
-       test_expect_success "$cmd --stat=width with big change and long name favors name part" '
+       test_expect_success "$cmd --stat=width with big change is more balanced" '
                git $cmd $args --stat-width=60 >output &&
                grep " | " output >actual &&
                test_cmp expect actual
@@ -146,6 +181,9 @@ EOF
 cat >expect80 <<'EOF'
  ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++
 EOF
+cat >expect200 <<'EOF'
+ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+EOF
 while read verb expect cmd args
 do
        test_expect_success "$cmd $verb COLUMNS (long filename)" '
@@ -155,15 +193,15 @@ do
        '
 done <<\EOF
 ignores expect80 format-patch -1 --stdout
-ignores expect80 diff HEAD^ HEAD --stat
-ignores expect80 show --stat
-ignores expect80 log -1 --stat
+respects expect200 diff HEAD^ HEAD --stat
+respects expect200 show --stat
+respects expect200 log -1 --stat
 EOF
 
 cat >expect <<'EOF'
- abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 EOF
-test_expect_success 'merge --stat ignores COLUMNS (big change)' '
+test_expect_success 'merge --stat respects COLUMNS (big change)' '
        git checkout -b branch HEAD^^ &&
        COLUMNS=100 git merge --stat --no-ff master^ >output &&
        grep " | " output >actual
@@ -171,9 +209,9 @@ test_expect_success 'merge --stat ignores COLUMNS (big change)' '
 '
 
 cat >expect <<'EOF'
...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++
 EOF
-test_expect_success 'merge --stat ignores COLUMNS (long filename)' '
+test_expect_success 'merge --stat respects COLUMNS (long filename)' '
        COLUMNS=100 git merge --stat --no-ff master >output &&
        grep " | " output >actual
        test_cmp expect actual