12
. ./test-lib.sh
13
. "$TEST_DIRECTORY"/lib-terminal.sh
14
15
-# 120 character name
15
+# 120-character name
16
name=aaaaaaaaaa
17
name=$name$name$name$name$name$name$name$name$name$name$name$name
18
test_expect_success 'preparation' '
58
do
59
# No width limit applied when statNameWidth is ignored
60
case "$expect" in expect72|expect.6030)
61
- test_expect_success "$cmd $verb statNameWidth config with long name" '
61
+ test_expect_success "$cmd $verb diff.statNameWidth with long name" '
62
git -c diff.statNameWidth=30 $cmd $args >output &&
63
grep " | " output >actual &&
64
test_cmp $expect actual
66
esac
67
# Maximum width limit still applied when statNameWidth is ignored
68
case "$expect" in expect.60|expect.6030)
69
- test_expect_success "$cmd --stat=width $verb statNameWidth config with long name" '
69
+ test_expect_success "$cmd --stat=width $verb diff.statNameWidth with long name" '
70
git -c diff.statNameWidth=30 $cmd $args --stat=60 >output &&
71
grep " | " output >actual &&
72
test_cmp $expect actual
111
test_cmp $expect.6030 actual
112
'
113
114
- test_expect_success "$cmd --stat-name-width with long name" '
114
+ test_expect_success "$cmd --stat-name-width=width with long name" '
115
git $cmd $args --stat-name-width=30 >output &&
116
grep " | " output >actual &&
117
test_cmp $expect.6030 actual
123
expect log -1 --stat
124
EOF
125
126
-test_expect_success 'preparation for big change tests' '
126
+test_expect_success 'preparation for big-change tests' '
127
>abcd &&
128
git add abcd &&
129
git commit -m message &&
139
abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
140
abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
141
EOF
142
-test_expect_success "format-patch --cover-letter ignores COLUMNS (big change)" '
142
+test_expect_success "format-patch --cover-letter ignores COLUMNS with big change" '
143
COLUMNS=200 git format-patch -1 --stdout --cover-letter >output &&
144
grep " | " output >actual &&
145
test_cmp expect72 actual
159
EOF
160
while read verb expect cmd args
161
do
162
- test_expect_success "$cmd $verb COLUMNS (big change)" '
162
+ test_expect_success "$cmd $verb COLUMNS with big change" '
163
COLUMNS=200 git $cmd $args >output &&
164
grep " | " output >actual &&
165
test_cmp "$expect" actual
167
168
case "$cmd" in diff|show) continue;; esac
169
170
- test_expect_success "$cmd --graph $verb COLUMNS (big change)" '
170
+ test_expect_success "$cmd --graph $verb COLUMNS with big change" '
171
COLUMNS=200 git $cmd $args --graph >output &&
172
grep " | " output >actual &&
173
test_cmp "$expect-graph" actual
187
EOF
188
while read verb expect cmd args
189
do
190
- test_expect_success "$cmd $verb not enough COLUMNS (big change)" '
190
+ test_expect_success "$cmd $verb not enough COLUMNS with big change" '
191
COLUMNS=40 git $cmd $args >output &&
192
grep " | " output >actual &&
193
test_cmp "$expect" actual
195
196
case "$cmd" in diff|show) continue;; esac
197
198
- test_expect_success "$cmd --graph $verb not enough COLUMNS (big change)" '
198
+ test_expect_success "$cmd --graph $verb not enough COLUMNS with big change" '
199
COLUMNS=40 git $cmd $args --graph >output &&
200
grep " | " output >actual &&
201
test_cmp "$expect-graph" actual
215
EOF
216
while read verb expect cmd args
217
do
218
- test_expect_success "$cmd $verb statGraphWidth config" '
218
+ test_expect_success "$cmd $verb diff.statGraphWidth" '
219
git -c diff.statGraphWidth=26 $cmd $args >output &&
220
grep " | " output >actual &&
221
test_cmp "$expect" actual
223
224
case "$cmd" in diff|show) continue;; esac
225
226
- test_expect_success "$cmd --graph $verb statGraphWidth config" '
226
+ test_expect_success "$cmd --graph $verb diff.statGraphWidth" '
227
git -c diff.statGraphWidth=26 $cmd $args --graph >output &&
228
grep " | " output >actual &&
229
test_cmp "$expect-graph" actual
255
test_cmp expect actual
256
'
257
258
- test_expect_success "$cmd --stat-graph-width with big change" '
258
+ test_expect_success "$cmd --stat-graph-width=width with big change" '
259
git $cmd $args --stat-graph-width=26 >output &&
260
grep " | " output >actual &&
261
test_cmp expect actual
269
test_cmp expect-graph actual
270
'
271
272
- test_expect_success "$cmd --stat-graph-width --graph with big change" '
272
+ test_expect_success "$cmd --stat-graph-width=width --graph with big change" '
273
git $cmd $args --stat-graph-width=26 --graph >output &&
274
grep " | " output >actual &&
275
test_cmp expect-graph actual
281
log -1 --stat
282
EOF
283
284
-test_expect_success 'preparation for long filename tests' '
284
+test_expect_success 'preparation for long-name tests' '
285
cp abcd aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
286
git add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&
287
git commit -m message
329
EOF
330
while read verb expect cmd args
331
do
332
- test_expect_success "$cmd $verb COLUMNS (long filename)" '
332
+ test_expect_success "$cmd $verb COLUMNS with long name" '
333
COLUMNS=200 git $cmd $args >output &&
334
grep " | " output >actual &&
335
test_cmp "$expect" actual
337
338
case "$cmd" in diff|show) continue;; esac
339
340
- test_expect_success "$cmd --graph $verb COLUMNS (long filename)" '
340
+ test_expect_success "$cmd --graph $verb COLUMNS with long name" '
341
COLUMNS=200 git $cmd $args --graph >output &&
342
grep " | " output >actual &&
343
test_cmp "$expect-graph" actual
358
while read verb expect cmd args
359
do
360
test_expect_success COLUMNS_CAN_BE_1 \
361
- "$cmd $verb prefix greater than COLUMNS (big change)" '
361
+ "$cmd $verb prefix greater than COLUMNS with big change" '
362
COLUMNS=1 git $cmd $args >output &&
363
grep " | " output >actual &&
364
test_cmp "$expect" actual
367
case "$cmd" in diff|show) continue;; esac
368
369
test_expect_success COLUMNS_CAN_BE_1 \
370
- "$cmd --graph $verb prefix greater than COLUMNS (big change)" '
370
+ "$cmd --graph $verb prefix greater than COLUMNS with big change" '
371
COLUMNS=1 git $cmd $args --graph >output &&
372
grep " | " output >actual &&
373
test_cmp "$expect-graph" actual
382
cat >expect <<'EOF'
383
abcd | 1000 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
384
EOF
385
-test_expect_success 'merge --stat respects COLUMNS (big change)' '
386
- git checkout -b branch HEAD^^ &&
385
+test_expect_success 'merge --stat respects diff.statGraphWidth with big change' '
386
+ git checkout -b branch1 HEAD^^ &&
387
+ git -c diff.statGraphWidth=26 merge --stat --no-ff main^ >output &&
388
+ grep " | " output >actual &&
389
+ test_cmp expect40 actual
390
+'
391
+test_expect_success 'merge --stat respects COLUMNS with big change' '
392
+ git checkout -b branch2 HEAD^^ &&
393
COLUMNS=100 git merge --stat --no-ff main^ >output &&
394
grep " | " output >actual &&
395
test_cmp expect actual
398
cat >expect <<'EOF'
399
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 +++++++++++++++++++++++++++++++++++++++
400
EOF
395
-test_expect_success 'merge --stat respects COLUMNS (long filename)' '
401
+cat >expect.30 <<'EOF'
402
+ ...aaaaaaaaaaaaaaaaaaaaaaaaaaa | 1000 ++++++++++++++++++++++++++++++++++++++++
403
+EOF
404
+test_expect_success 'merge --stat respects diff.statNameWidth with long name' '
405
+ git switch branch1 &&
406
+ git -c diff.statNameWidth=30 merge --stat --no-ff main >output &&
407
+ grep " | " output >actual &&
408
+ test_cmp expect.30 actual
409
+'
410
+test_expect_success 'merge --stat respects COLUMNS with long name' '
411
+ git switch branch2 &&
412
COLUMNS=100 git merge --stat --no-ff main >output &&
413
grep " | " output >actual &&
414
test_cmp expect actual