Skip to content

Commit da79161

Browse files
lucianpostongitster
authored andcommitted
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 <lucian.poston@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 36dcc02 commit da79161

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

t/t4052-stat-output.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,34 @@ respects expect200 show --stat
284284
respects expect200 log -1 --stat
285285
EOF
286286

287+
cat >expect1 <<'EOF'
288+
...aaaaaaa | 1000 ++++++
289+
EOF
290+
cat >expect1-graph <<'EOF'
291+
| ...aaaaaaa | 1000 ++++++
292+
EOF
293+
while read teststate verb expect cmd args
294+
do
295+
test_expect_$teststate "$cmd $verb prefix greater than COLUMNS (big change)" '
296+
COLUMNS=1 git $cmd $args >output
297+
grep " | " output >actual &&
298+
test_cmp "$expect" actual
299+
'
300+
301+
test "$cmd" != diff || continue
302+
303+
test_expect_$teststate "$cmd --graph $verb prefix greater than COLUMNS (big change)" '
304+
COLUMNS=1 git $cmd $args --graph >output
305+
grep " | " output >actual &&
306+
test_cmp "$expect-graph" actual
307+
'
308+
done <<\EOF
309+
success ignores expect80 format-patch -1 --stdout
310+
failure respects expect1 diff HEAD^ HEAD --stat
311+
failure respects expect1 show --stat
312+
failure respects expect1 log -1 --stat
313+
EOF
314+
287315
cat >expect <<'EOF'
288316
abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
289317
EOF

0 commit comments

Comments
 (0)