diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-09-29 09:04:14 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-09-29 09:04:15 -0700 |
| commit | 0b493d2986ab2664a35a87db04154c795f74d3fd (patch) | |
| tree | 6cedffded7f4367108e37bdc2c78c57f2668e66a /t | |
| parent | Merge branch 'jk/fsmonitor-unused-parameter' (diff) | |
| parent | diff --stat: add config option to limit filename width (diff) | |
| download | git-0b493d2986ab2664a35a87db04154c795f74d3fd.tar.gz git-0b493d2986ab2664a35a87db04154c795f74d3fd.zip | |
Merge branch 'ds/stat-name-width-configuration'
"git diff" learned diff.statNameWidth configuration variable, to
give the default width for the name part in the "--stat" output.
* ds/stat-name-width-configuration:
diff --stat: add config option to limit filename width
Diffstat (limited to 't')
| -rwxr-xr-x | t/t4052-stat-output.sh | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/t/t4052-stat-output.sh b/t/t4052-stat-output.sh index 3ee27e277d..beb2ec2a55 100755 --- a/t/t4052-stat-output.sh +++ b/t/t4052-stat-output.sh @@ -49,12 +49,41 @@ log -1 --stat EOF cat >expect.60 <<-'EOF' - ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + EOF cat >expect.6030 <<-'EOF' ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + EOF -cat >expect2.60 <<-'EOF' +while read verb expect cmd args +do + # No width limit applied when statNameWidth is ignored + case "$expect" in expect72|expect.6030) + test_expect_success "$cmd $verb statNameWidth config with long name" ' + git -c diff.statNameWidth=30 $cmd $args >output && + grep " | " output >actual && + test_cmp $expect actual + ';; + esac + # Maximum width limit still applied when statNameWidth is ignored + case "$expect" in expect.60|expect.6030) + test_expect_success "$cmd --stat=width $verb statNameWidth config with long name" ' + git -c diff.statNameWidth=30 $cmd $args --stat=60 >output && + grep " | " output >actual && + test_cmp $expect actual + ';; + esac +done <<\EOF +ignores expect72 format-patch -1 --stdout +ignores expect.60 format-patch -1 --stdout +respects expect.6030 diff HEAD^ HEAD --stat +respects expect.6030 show --stat +respects expect.6030 log -1 --stat +EOF + +cat >expect.40 <<-'EOF' + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + +EOF +cat >expect2.40 <<-'EOF' ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + ...aaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1 + EOF @@ -67,16 +96,16 @@ do 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.60 actual + test_cmp $expect.40 actual ' test_expect_success "$cmd --stat-width=width with long name" ' git $cmd $args --stat-width=40 >output && grep " | " output >actual && - test_cmp $expect.60 actual + test_cmp $expect.40 actual ' - test_expect_success "$cmd --stat=...,name-width with long name" ' + test_expect_success "$cmd --stat=width,name-width with long name" ' git $cmd $args --stat=60,30 >output && grep " | " output >actual && test_cmp $expect.6030 actual @@ -94,7 +123,6 @@ expect show --stat expect log -1 --stat EOF - test_expect_success 'preparation for big change tests' ' >abcd && git add abcd && @@ -207,7 +235,6 @@ respects expect40 show --stat respects expect40 log -1 --stat EOF - cat >expect <<'EOF' abcd | 1000 ++++++++++++++++++++++++++ EOF |
