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>
Lucian Poston committed
Apr 18, 2012 at 14:09 UTC
da79161db6dcb0643ab805e5cf78d7e4e34ce993
1 file changed
+28
t/t4052-stat-output.sh
+28
@@ -284,6 +284,34 @@ respects expect200 show --stat
284
respects expect200 log -1 --stat
285
EOF
286
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
+
315
cat >expect <<'EOF'
316
abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
317
EOF