175
Reported-by: C3 E3
176
Mentored-by: C4 E4
177
EOF
178
- git cat-file commit HEAD >commit.msg &&
179
- sed -e "1,/^\$/d" commit.msg >actual &&
178
+ commit_body HEAD >actual &&
179
test_cmp expected actual
180
'
181
194
commit --trailer "Mentored-by: C4 E4" \
195
--trailer "Helped-by: C3 E3" \
196
--amend &&
198
- git cat-file commit HEAD >commit.msg &&
199
- sed -e "1,/^\$/d" commit.msg >actual &&
197
+ commit_body HEAD >actual &&
198
test_cmp expected actual
199
'
200
215
commit --trailer "Reported-by: C3 E3" \
216
--trailer "Mentored-by: C4 E4" \
217
--amend &&
220
- git cat-file commit HEAD >commit.msg &&
221
- sed -e "1,/^\$/d" commit.msg >actual &&
218
+ commit_body HEAD >actual &&
219
test_cmp expected actual
220
'
221
235
commit --trailer "Mentored-by: C5 E5" \
236
--trailer "Reviewed-by: C6 E6" \
237
--amend &&
241
- git cat-file commit HEAD >commit.msg &&
242
- sed -e "1,/^\$/d" commit.msg >actual &&
238
+ commit_body HEAD >actual &&
239
test_cmp expected actual
240
'
241
255
commit --trailer "Reported-by: C3 E3" \
256
--trailer "Mentored-by: C5 E5" \
257
--amend &&
262
- git cat-file commit HEAD >commit.msg &&
263
- sed -e "1,/^\$/d" commit.msg >actual &&
258
+ commit_body HEAD >actual &&
259
test_cmp expected actual
260
'
261
275
commit --trailer "Mentored-by: C4 E4" \
276
--trailer "Reported-by: C3 E3" \
277
--amend &&
283
- git cat-file commit HEAD >commit.msg &&
284
- sed -e "1,/^\$/d" commit.msg >actual &&
278
+ commit_body HEAD >actual &&
279
test_cmp expected actual
280
'
281
296
commit --trailer "Reported-by: C3 E3" \
297
--trailer "Mentored-by: C4 E4" \
298
--amend &&
305
- git cat-file commit HEAD >commit.msg &&
306
- sed -e "1,/^\$/d" commit.msg >actual &&
299
+ commit_body HEAD >actual &&
300
test_cmp expected actual
301
'
302
316
commit --trailer "Signed-off-by: C O Mitter <committer@example.com>" \
317
--trailer "Signed-off-by: C1 E1" \
318
--amend &&
326
- git cat-file commit HEAD >commit.msg &&
327
- sed -e "1,/^\$/d" commit.msg >actual &&
319
+ commit_body HEAD >actual &&
320
test_cmp expected actual
321
'
322
336
commit --trailer "Mentored-by: C4 E4" \
337
--trailer "Mentored-by: C5 E5" \
338
--amend &&
347
- git cat-file commit HEAD >commit.msg &&
348
- sed -e "1,/^\$/d" commit.msg >actual &&
339
+ commit_body HEAD >actual &&
340
test_cmp expected actual
341
'
342
357
commit --trailer "Mentored-by: C3 E3" \
358
--trailer "Mentored-by: C2 E2" \
359
--amend &&
369
- git cat-file commit HEAD >commit.msg &&
370
- sed -e "1,/^\$/d" commit.msg >actual &&
360
+ commit_body HEAD >actual &&
361
test_cmp expected actual
362
'
363
377
commit --trailer "Helped-by: C5 E5" \
378
--trailer "Based-by: C6 E6" \
379
--amend &&
390
- git cat-file commit HEAD >commit.msg &&
391
- sed -e "1,/^\$/d" commit.msg >actual &&
380
+ commit_body HEAD >actual &&
381
test_cmp expected actual
382
'
383
398
commit --trailer "Helped-by: C5 E5" \
399
--trailer "Based-by: C6 E6" \
400
--amend &&
412
- git cat-file commit HEAD >commit.msg &&
413
- sed -e "1,/^\$/d" commit.msg >actual &&
401
+ commit_body HEAD >actual &&
402
test_cmp expected actual
403
'
404
412
EOF
413
git -c trailer.ack.key="Acked-by" \
414
commit --trailer "ack = Peff" -m "hello" &&
427
- git cat-file commit HEAD >commit.msg &&
428
- sed -e "1,/^\$/d" commit.msg >actual &&
415
+ commit_body HEAD >actual &&
416
test_cmp expected actual
417
'
418
427
git -c trailer.separators=":=#" \
428
-c trailer.bug.key="Bug #" \
429
commit --trailer "bug = 42" -m "I hate bug" &&
443
- git cat-file commit HEAD >commit.msg &&
444
- sed -e "1,/^\$/d" commit.msg >actual &&
430
+ commit_body HEAD >actual &&
431
test_cmp expected actual
432
'
433
447
-c trailer.report.command="NAME=\"\$ARG\"; test -n \"\$NAME\" && \
448
git log --author=\"\$NAME\" -1 --format=\"format:%aN <%aE>\" || true" \
449
commit --trailer "report = author" --amend &&
464
- git cat-file commit HEAD >commit.msg &&
465
- sed -e "1,/^\$/d" commit.msg >actual &&
450
+ commit_body HEAD >actual &&
451
test_cmp expected actual
452
'
453
465
echo &&
466
echo "my-trailer: value"
467
} >expected &&
483
- git cat-file commit HEAD >commit.msg &&
484
- sed -e "1,/^\$/d" commit.msg >actual &&
468
+ commit_body HEAD >actual &&
469
test_cmp expected actual
470
'
471
482
echo &&
483
echo "my-trailer: value"
484
} >expected &&
501
- git cat-file commit HEAD >commit.msg &&
502
- sed -e "1,/^\$/d" commit.msg >actual &&
485
+ commit_body HEAD >actual &&
486
test_cmp expected actual
487
'
488
491
>negative &&
492
git add negative &&
493
git commit -m "one" -m "two" -m "three" &&
511
- actual=$(git cat-file commit HEAD >tmp && sed -e "1,/^\$/d" tmp && rm tmp) &&
494
+ actual=$(commit_body HEAD) &&
495
expected=$(test_write_lines "one" "" "two" "" "three") &&
496
test "z$actual" = "z$expected"
497
528
529
echo >>negative &&
530
git commit --cleanup=verbatim --no-status -t expect -a &&
548
- git cat-file -p HEAD >raw &&
549
- sed -e "1,/^\$/d" raw >actual &&
531
+ commit_body HEAD >actual &&
532
test_cmp expect actual
533
534
'
537
538
echo >>negative &&
539
git commit --cleanup=verbatim -F expect -a &&
558
- git cat-file -p HEAD >raw &&
559
- sed -e "1,/^\$/d" raw >actual &&
540
+ commit_body HEAD >actual &&
541
test_cmp expect actual
542
543
'
546
547
echo >>negative &&
548
git commit --cleanup=verbatim -m "$mesg_with_comment_and_newlines" -a &&
568
- git cat-file -p HEAD >raw &&
569
- sed -e "1,/^\$/d" raw >actual &&
549
+ commit_body HEAD >actual &&
550
test_cmp expect actual
551
552
'
557
test_write_lines "" "# text" "" >text &&
558
echo "# text" >expect &&
559
git commit --cleanup=whitespace -F text -a &&
580
- git cat-file -p HEAD >raw &&
581
- sed -e "1,/^\$/d" raw >actual &&
560
+ commit_body HEAD >actual &&
561
test_cmp expect actual
562
563
'
584
# to be kept, too
585
EOF
586
git commit --cleanup=scissors -e -F text -a &&
608
- git cat-file -p HEAD >raw &&
609
- sed -e "1,/^\$/d" raw >actual &&
587
+ commit_body HEAD >actual &&
588
test_cmp expect actual
589
'
590
596
to be removed
597
EOF
598
git commit --cleanup=scissors -e -F text -a --allow-empty-message &&
621
- git cat-file -p HEAD >raw &&
622
- sed -e "1,/^\$/d" raw >actual &&
599
+ commit_body HEAD >actual &&
600
test_must_be_empty actual
601
'
602
606
test_write_lines "" "# text" "sample" "" >text &&
607
echo sample >expect &&
608
git commit --cleanup=strip -F text -a &&
632
- git cat-file -p HEAD >raw &&
633
- sed -e "1,/^\$/d" raw >actual &&
609
+ commit_body HEAD >actual &&
610
test_cmp expect actual
611
612
'
825
826
git reset --hard &&
827
git commit -s -m "hello: kitty" --allow-empty &&
852
- git cat-file commit HEAD >raw &&
853
- sed -e "1,/^$/d" raw >actual &&
828
+ commit_body HEAD >actual &&
829
test_line_count = 3 actual
830
831
'