@@ -576,7 +576,7 @@ test_expect_success 'range-diff with multiple --notes' '
576
576
test_cmp expect actual
577
577
'
578
578
579
- test_expect_success ' format-patch --range-diff compares notes by default' '
579
+ test_expect_success ' format-patch --range-diff does not compare notes by default' '
580
580
git notes add -m "topic note" topic &&
581
581
git notes add -m "unmodified note" unmodified &&
582
582
test_when_finished git notes remove topic unmodified &&
@@ -588,6 +588,40 @@ test_expect_success 'format-patch --range-diff compares notes by default' '
588
588
grep "= 1: .* s/5/A" 0000-* &&
589
589
grep "= 2: .* s/4/A" 0000-* &&
590
590
grep "= 3: .* s/11/B" 0000-* &&
591
+ grep "= 4: .* s/12/B" 0000-* &&
592
+ ! grep "Notes" 0000-* &&
593
+ ! grep "note" 0000-*
594
+ '
595
+
596
+ test_expect_success ' format-patch --range-diff with --no-notes' '
597
+ git notes add -m "topic note" topic &&
598
+ git notes add -m "unmodified note" unmodified &&
599
+ test_when_finished git notes remove topic unmodified &&
600
+ git format-patch --no-notes --cover-letter --range-diff=$prev \
601
+ master..unmodified >actual &&
602
+ test_when_finished "rm 000?-*" &&
603
+ test_line_count = 5 actual &&
604
+ test_i18ngrep "^Range-diff:$" 0000-* &&
605
+ grep "= 1: .* s/5/A" 0000-* &&
606
+ grep "= 2: .* s/4/A" 0000-* &&
607
+ grep "= 3: .* s/11/B" 0000-* &&
608
+ grep "= 4: .* s/12/B" 0000-* &&
609
+ ! grep "Notes" 0000-* &&
610
+ ! grep "note" 0000-*
611
+ '
612
+
613
+ test_expect_success ' format-patch --range-diff with --notes' '
614
+ git notes add -m "topic note" topic &&
615
+ git notes add -m "unmodified note" unmodified &&
616
+ test_when_finished git notes remove topic unmodified &&
617
+ git format-patch --notes --cover-letter --range-diff=$prev \
618
+ master..unmodified >actual &&
619
+ test_when_finished "rm 000?-*" &&
620
+ test_line_count = 5 actual &&
621
+ test_i18ngrep "^Range-diff:$" 0000-* &&
622
+ grep "= 1: .* s/5/A" 0000-* &&
623
+ grep "= 2: .* s/4/A" 0000-* &&
624
+ grep "= 3: .* s/11/B" 0000-* &&
591
625
grep "! 4: .* s/12/B" 0000-* &&
592
626
sed s/Z/\ /g >expect <<-EOF &&
593
627
@@ Commit message
@@ -604,4 +638,69 @@ test_expect_success 'format-patch --range-diff compares notes by default' '
604
638
test_cmp expect actual
605
639
'
606
640
641
+ test_expect_success ' format-patch --range-diff with --notes' '
642
+ git notes add -m "topic note" topic &&
643
+ git notes add -m "unmodified note" unmodified &&
644
+ test_when_finished git notes remove topic unmodified &&
645
+ test_config format.notes true &&
646
+ git format-patch --cover-letter --range-diff=$prev \
647
+ master..unmodified >actual &&
648
+ test_when_finished "rm 000?-*" &&
649
+ test_line_count = 5 actual &&
650
+ test_i18ngrep "^Range-diff:$" 0000-* &&
651
+ grep "= 1: .* s/5/A" 0000-* &&
652
+ grep "= 2: .* s/4/A" 0000-* &&
653
+ grep "= 3: .* s/11/B" 0000-* &&
654
+ grep "! 4: .* s/12/B" 0000-* &&
655
+ sed s/Z/\ /g >expect <<-EOF &&
656
+ @@ Commit message
657
+ Z
658
+ Z
659
+ Z ## Notes ##
660
+ - topic note
661
+ + unmodified note
662
+ Z
663
+ Z ## file ##
664
+ Z@@ file: A
665
+ EOF
666
+ sed "/@@ Commit message/,/@@ file: A/!d" 0000-* >actual &&
667
+ test_cmp expect actual
668
+ '
669
+
670
+ test_expect_success ' format-patch --range-diff with multiple notes' '
671
+ git notes --ref=note1 add -m "topic note1" topic &&
672
+ git notes --ref=note1 add -m "unmodified note1" unmodified &&
673
+ test_when_finished git notes --ref=note1 remove topic unmodified &&
674
+ git notes --ref=note2 add -m "topic note2" topic &&
675
+ git notes --ref=note2 add -m "unmodified note2" unmodified &&
676
+ test_when_finished git notes --ref=note2 remove topic unmodified &&
677
+ git format-patch --notes=note1 --notes=note2 --cover-letter --range-diff=$prev \
678
+ master..unmodified >actual &&
679
+ test_when_finished "rm 000?-*" &&
680
+ test_line_count = 5 actual &&
681
+ test_i18ngrep "^Range-diff:$" 0000-* &&
682
+ grep "= 1: .* s/5/A" 0000-* &&
683
+ grep "= 2: .* s/4/A" 0000-* &&
684
+ grep "= 3: .* s/11/B" 0000-* &&
685
+ grep "! 4: .* s/12/B" 0000-* &&
686
+ sed s/Z/\ /g >expect <<-EOF &&
687
+ @@ Commit message
688
+ Z
689
+ Z
690
+ Z ## Notes (note1) ##
691
+ - topic note1
692
+ + unmodified note1
693
+ Z
694
+ Z
695
+ Z ## Notes (note2) ##
696
+ - topic note2
697
+ + unmodified note2
698
+ Z
699
+ Z ## file ##
700
+ Z@@ file: A
701
+ EOF
702
+ sed "/@@ Commit message/,/@@ file: A/!d" 0000-* >actual &&
703
+ test_cmp expect actual
704
+ '
705
+
607
706
test_done
0 commit comments