114
test_must_fail git log --pretty=test-foo
115
'
116
117
-test_expect_success 'NUL separation' '
117
+test_expect_success ICONV 'NUL separation' '
118
printf "add bar\0$(commit_msg)" >expected &&
119
git log -z --pretty="format:%s" >actual &&
120
test_cmp expected actual
121
'
122
123
-test_expect_success 'NUL termination' '
123
+test_expect_success ICONV 'NUL termination' '
124
printf "add bar\0$(commit_msg)\0" >expected &&
125
git log -z --pretty="tformat:%s" >actual &&
126
test_cmp expected actual
127
'
128
129
-test_expect_success 'NUL separation with --stat' '
129
+test_expect_success ICONV 'NUL separation with --stat' '
130
stat0_part=$(git diff --stat HEAD^ HEAD) &&
131
stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
132
printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected &&
181
head4=$(git rev-parse --verify --short HEAD~3)
182
'
183
184
-test_expect_success 'left alignment formatting' '
184
+test_expect_success ICONV 'left alignment formatting' '
185
git log --pretty="tformat:%<(40)%s" >actual &&
186
qz_to_tab_space <<-EOF >expected &&
187
message two Z
192
test_cmp expected actual
193
'
194
195
-test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '
195
+test_expect_success ICONV 'left alignment formatting. i18n.logOutputEncoding' '
196
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(40)%s" >actual &&
197
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
198
message two Z
203
test_cmp expected actual
204
'
205
206
-test_expect_success 'left alignment formatting at the nth column' '
206
+test_expect_success ICONV 'left alignment formatting at the nth column' '
207
git log --pretty="tformat:%h %<|(40)%s" >actual &&
208
qz_to_tab_space <<-EOF >expected &&
209
$head1 message two Z
214
test_cmp expected actual
215
'
216
217
-test_expect_success 'left alignment formatting at the nth column' '
217
+test_expect_success ICONV 'left alignment formatting at the nth column' '
218
COLUMNS=50 git log --pretty="tformat:%h %<|(-10)%s" >actual &&
219
qz_to_tab_space <<-EOF >expected &&
220
$head1 message two Z
225
test_cmp expected actual
226
'
227
228
-test_expect_success 'left alignment formatting at the nth column. i18n.logOutputEncoding' '
228
+test_expect_success ICONV 'left alignment formatting at the nth column. i18n.logOutputEncoding' '
229
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %<|(40)%s" >actual &&
230
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
231
$head1 message two Z
236
test_cmp expected actual
237
'
238
239
-test_expect_success 'left alignment formatting with no padding' '
239
+test_expect_success ICONV 'left alignment formatting with no padding' '
240
git log --pretty="tformat:%<(1)%s" >actual &&
241
cat <<-EOF >expected &&
242
message two
258
test_cmp expected actual
259
'
260
261
-test_expect_success 'left alignment formatting with trunc' '
261
+test_expect_success ICONV 'left alignment formatting with trunc' '
262
git log --pretty="tformat:%<(10,trunc)%s" >actual &&
263
qz_to_tab_space <<-\EOF >expected &&
264
message ..
269
test_cmp expected actual
270
'
271
272
-test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' '
272
+test_expect_success ICONV 'left alignment formatting with trunc. i18n.logOutputEncoding' '
273
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s" >actual &&
274
qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
275
message ..
280
test_cmp expected actual
281
'
282
283
-test_expect_success 'left alignment formatting with ltrunc' '
283
+test_expect_success ICONV 'left alignment formatting with ltrunc' '
284
git log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
285
qz_to_tab_space <<-EOF >expected &&
286
..sage two
291
test_cmp expected actual
292
'
293
294
-test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '
294
+test_expect_success ICONV 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '
295
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
296
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
297
..sage two
302
test_cmp expected actual
303
'
304
305
-test_expect_success 'left alignment formatting with mtrunc' '
305
+test_expect_success ICONV 'left alignment formatting with mtrunc' '
306
git log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
307
qz_to_tab_space <<-\EOF >expected &&
308
mess.. two
313
test_cmp expected actual
314
'
315
316
-test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '
316
+test_expect_success ICONV 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '
317
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
318
qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
319
mess.. two
324
test_cmp expected actual
325
'
326
327
-test_expect_success 'right alignment formatting' '
327
+test_expect_success ICONV 'right alignment formatting' '
328
git log --pretty="tformat:%>(40)%s" >actual &&
329
qz_to_tab_space <<-EOF >expected &&
330
Z message two
335
test_cmp expected actual
336
'
337
338
-test_expect_success 'right alignment formatting. i18n.logOutputEncoding' '
338
+test_expect_success ICONV 'right alignment formatting. i18n.logOutputEncoding' '
339
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(40)%s" >actual &&
340
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
341
Z message two
346
test_cmp expected actual
347
'
348
349
-test_expect_success 'right alignment formatting at the nth column' '
349
+test_expect_success ICONV 'right alignment formatting at the nth column' '
350
git log --pretty="tformat:%h %>|(40)%s" >actual &&
351
qz_to_tab_space <<-EOF >expected &&
352
$head1 message two
357
test_cmp expected actual
358
'
359
360
-test_expect_success 'right alignment formatting at the nth column' '
360
+test_expect_success ICONV 'right alignment formatting at the nth column' '
361
COLUMNS=50 git log --pretty="tformat:%h %>|(-10)%s" >actual &&
362
qz_to_tab_space <<-EOF >expected &&
363
$head1 message two
368
test_cmp expected actual
369
'
370
371
-test_expect_success 'right alignment formatting at the nth column. i18n.logOutputEncoding' '
371
+test_expect_success ICONV 'right alignment formatting at the nth column. i18n.logOutputEncoding' '
372
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %>|(40)%s" >actual &&
373
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
374
$head1 message two
381
382
# Note: Space between 'message' and 'two' should be in the same column
383
# as in previous test.
384
-test_expect_success 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' '
384
+test_expect_success ICONV 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' '
385
git -c i18n.logOutputEncoding=$test_encoding log --graph --pretty="tformat:%h %>|(40)%s" >actual &&
386
iconv -f utf-8 -t $test_encoding >expected <<-EOF &&
387
* $head1 message two
392
test_cmp expected actual
393
'
394
395
-test_expect_success 'right alignment formatting with no padding' '
395
+test_expect_success ICONV 'right alignment formatting with no padding' '
396
git log --pretty="tformat:%>(1)%s" >actual &&
397
cat <<-EOF >expected &&
398
message two
403
test_cmp expected actual
404
'
405
406
-test_expect_success 'right alignment formatting with no padding and with --graph' '
406
+test_expect_success ICONV 'right alignment formatting with no padding and with --graph' '
407
git log --graph --pretty="tformat:%>(1)%s" >actual &&
408
cat <<-EOF >expected &&
409
* message two
414
test_cmp expected actual
415
'
416
417
-test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' '
417
+test_expect_success ICONV 'right alignment formatting with no padding. i18n.logOutputEncoding' '
418
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(1)%s" >actual &&
419
cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
420
message two
425
test_cmp expected actual
426
'
427
428
-test_expect_success 'center alignment formatting' '
428
+test_expect_success ICONV 'center alignment formatting' '
429
git log --pretty="tformat:%><(40)%s" >actual &&
430
qz_to_tab_space <<-EOF >expected &&
431
Z message two Z
436
test_cmp expected actual
437
'
438
439
-test_expect_success 'center alignment formatting. i18n.logOutputEncoding' '
439
+test_expect_success ICONV 'center alignment formatting. i18n.logOutputEncoding' '
440
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(40)%s" >actual &&
441
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
442
Z message two Z
446
EOF
447
test_cmp expected actual
448
'
449
-test_expect_success 'center alignment formatting at the nth column' '
449
+test_expect_success ICONV 'center alignment formatting at the nth column' '
450
git log --pretty="tformat:%h %><|(40)%s" >actual &&
451
qz_to_tab_space <<-EOF >expected &&
452
$head1 message two Z
457
test_cmp expected actual
458
'
459
460
-test_expect_success 'center alignment formatting at the nth column' '
460
+test_expect_success ICONV 'center alignment formatting at the nth column' '
461
COLUMNS=70 git log --pretty="tformat:%h %><|(-30)%s" >actual &&
462
qz_to_tab_space <<-EOF >expected &&
463
$head1 message two Z
468
test_cmp expected actual
469
'
470
471
-test_expect_success 'center alignment formatting at the nth column. i18n.logOutputEncoding' '
471
+test_expect_success ICONV 'center alignment formatting at the nth column. i18n.logOutputEncoding' '
472
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %><|(40)%s" >actual &&
473
qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
474
$head1 message two Z
479
test_cmp expected actual
480
'
481
482
-test_expect_success 'center alignment formatting with no padding' '
482
+test_expect_success ICONV 'center alignment formatting with no padding' '
483
git log --pretty="tformat:%><(1)%s" >actual &&
484
cat <<-EOF >expected &&
485
message two
493
# save HEAD's SHA-1 digest (with no abbreviations) to use it below
494
# as far as the next test amends HEAD
495
old_head1=$(git rev-parse --verify HEAD~0)
496
-test_expect_success 'center alignment formatting with no padding. i18n.logOutputEncoding' '
496
+test_expect_success ICONV 'center alignment formatting with no padding. i18n.logOutputEncoding' '
497
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(1)%s" >actual &&
498
cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
499
message two
504
test_cmp expected actual
505
'
506
507
-test_expect_success 'left/right alignment formatting with stealing' '
507
+test_expect_success ICONV 'left/right alignment formatting with stealing' '
508
git commit --amend -m short --author "long long long <long@me.com>" &&
509
git log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual &&
510
cat <<-\EOF >expected &&
515
EOF
516
test_cmp expected actual
517
'
518
-test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '
518
+test_expect_success ICONV 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '
519
git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual &&
520
cat <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
521
short long long long
564
git tag -d tag1 &&
565
git commit --amend -m shorter &&
566
git log --no-walk --tags --pretty="%H %d" --decorate=full >actual &&
567
- cat <<-EOF >expected &&
568
- $head2 (tag: refs/tags/message-one)
569
- $old_head1 (tag: refs/tags/message-two)
570
- $head1 (tag: refs/tags/tag2)
571
- EOF
567
+ if test_have_prereq ICONV
568
+ then
569
+ cat <<-EOF >expected
570
+ $head2 (tag: refs/tags/message-one)
571
+ $old_head1 (tag: refs/tags/message-two)
572
+ $head1 (tag: refs/tags/tag2)
573
+ EOF
574
+ else
575
+ cat <<-EOF >expected
576
+ $head2 (tag: refs/tags/message-one)
577
+ $old_head1 (tag: refs/tags/tag2, tag: refs/tags/message-two)
578
+ EOF
579
+ fi &&
580
sort -k3 actual >actual1 &&
581
test_cmp expected actual1
582
'
583
584
test_expect_success 'clean log decoration' '
585
git log --no-walk --tags --pretty="%H %D" --decorate=full >actual &&
578
- cat >expected <<-EOF &&
579
- $head2 tag: refs/tags/message-one
580
- $old_head1 tag: refs/tags/message-two
581
- $head1 tag: refs/tags/tag2
582
- EOF
586
+ if test_have_prereq ICONV
587
+ then
588
+ cat <<-EOF >expected
589
+ $head2 tag: refs/tags/message-one
590
+ $old_head1 tag: refs/tags/message-two
591
+ $head1 tag: refs/tags/tag2
592
+ EOF
593
+ else
594
+ cat <<-EOF >expected
595
+ $head2 tag: refs/tags/message-one
596
+ $old_head1 tag: refs/tags/tag2, tag: refs/tags/message-two
597
+ EOF
598
+ fi &&
599
sort -k3 actual >actual1 &&
600
test_cmp expected actual1
601
'