@@ -538,33 +538,50 @@ test_expect_success 'with 2 files arguments' '
538
538
test_cmp expected actual
539
539
'
540
540
541
- test_expect_success ' with message that has comments' '
542
- cat basic_message >message_with_comments &&
543
- sed -e "s/ Z\$/ /" >>message_with_comments <<-\EOF &&
544
- # comment
545
-
546
- # other comment
547
- Cc: Z
548
- # yet another comment
549
- Reviewed-by: Johan
550
- Reviewed-by: Z
551
- # last comment
552
-
553
- EOF
554
- cat basic_patch >>message_with_comments &&
555
- cat basic_message >expected &&
556
- cat >>expected <<-\EOF &&
557
- # comment
558
-
559
- Reviewed-by: Johan
560
- Cc: Peff
561
- # last comment
562
-
563
- EOF
564
- cat basic_patch >>expected &&
565
- git interpret-trailers --trim-empty --trailer "Cc: Peff" message_with_comments >actual &&
566
- test_cmp expected actual
567
- '
541
+ # Cover multiple comment characters with the same test input.
542
+ for char in " #" " ;"
543
+ do
544
+ case " $char " in
545
+ " #" )
546
+ # This is the default, so let's explicitly _not_
547
+ # set any config to make sure it behaves as we expect.
548
+ ;;
549
+ * )
550
+ config=" -c core.commentChar=$char "
551
+ ;;
552
+ esac
553
+
554
+ test_expect_success " with message that has comments ($char )" '
555
+ cat basic_message >message_with_comments &&
556
+ sed -e "s/ Z\$/ /" \
557
+ -e "s/#/$char/g" >>message_with_comments <<-EOF &&
558
+ # comment
559
+
560
+ # other comment
561
+ Cc: Z
562
+ # yet another comment
563
+ Reviewed-by: Johan
564
+ Reviewed-by: Z
565
+ # last comment
566
+
567
+ EOF
568
+ cat basic_patch >>message_with_comments &&
569
+ cat basic_message >expected &&
570
+ sed -e "s/#/$char/g" >>expected <<-\EOF &&
571
+ # comment
572
+
573
+ Reviewed-by: Johan
574
+ Cc: Peff
575
+ # last comment
576
+
577
+ EOF
578
+ cat basic_patch >>expected &&
579
+ git $config interpret-trailers \
580
+ --trim-empty --trailer "Cc: Peff" \
581
+ message_with_comments >actual &&
582
+ test_cmp expected actual
583
+ '
584
+ done
568
585
569
586
test_expect_success ' with message that has an old style conflict block' '
570
587
cat basic_message >message_with_comments &&
0 commit comments