@@ -533,9 +533,9 @@ test_expect_success 'dual-coloring' '
533
533
for prev in topic main..topic
534
534
do
535
535
test_expect_success " format-patch --range-diff=$prev " '
536
+ test_when_finished "rm -f 000?-*" &&
536
537
git format-patch --cover-letter --range-diff=$prev \
537
538
main..unmodified >actual &&
538
- test_when_finished "rm 000?-*" &&
539
539
test_line_count = 5 actual &&
540
540
test_grep "^Range-diff:$" 0000-* &&
541
541
grep "= 1: .* s/5/A" 0000-* &&
@@ -560,32 +560,32 @@ test_expect_success "explicit --no-cover-letter defeats implied --cover-letter"
560
560
'
561
561
562
562
test_expect_success ' format-patch --range-diff as commentary' '
563
+ test_when_finished "rm -f 0001-*" &&
563
564
git format-patch --range-diff=HEAD~1 HEAD~1 >actual &&
564
- test_when_finished "rm 0001-*" &&
565
565
test_line_count = 1 actual &&
566
566
test_grep "^Range-diff:$" 0001-* &&
567
567
grep "> 1: .* new message" 0001-*
568
568
'
569
569
570
570
test_expect_success ' format-patch --range-diff reroll-count with a non-integer' '
571
+ test_when_finished "rm -f v2.9-0001-*" &&
571
572
git format-patch --range-diff=HEAD~1 -v2.9 HEAD~1 >actual &&
572
- test_when_finished "rm v2.9-0001-*" &&
573
573
test_line_count = 1 actual &&
574
574
test_grep "^Range-diff:$" v2.9-0001-* &&
575
575
grep "> 1: .* new message" v2.9-0001-*
576
576
'
577
577
578
578
test_expect_success ' format-patch --range-diff reroll-count with a integer' '
579
+ test_when_finished "rm -f v2-0001-*" &&
579
580
git format-patch --range-diff=HEAD~1 -v2 HEAD~1 >actual &&
580
- test_when_finished "rm v2-0001-*" &&
581
581
test_line_count = 1 actual &&
582
582
test_grep "^Range-diff ..* v1:$" v2-0001-* &&
583
583
grep "> 1: .* new message" v2-0001-*
584
584
'
585
585
586
586
test_expect_success ' format-patch --range-diff with v0' '
587
+ test_when_finished "rm -f v0-0001-*" &&
587
588
git format-patch --range-diff=HEAD~1 -v0 HEAD~1 >actual &&
588
- test_when_finished "rm v0-0001-*" &&
589
589
test_line_count = 1 actual &&
590
590
test_grep "^Range-diff:$" v0-0001-* &&
591
591
grep "> 1: .* new message" v0-0001-*
@@ -606,9 +606,9 @@ test_expect_success 'basic with modified format.pretty without "commit "' '
606
606
'
607
607
608
608
test_expect_success ' range-diff compares notes by default' '
609
+ test_when_finished "git notes remove topic unmodified || :" &&
609
610
git notes add -m "topic note" topic &&
610
611
git notes add -m "unmodified note" unmodified &&
611
- test_when_finished git notes remove topic unmodified &&
612
612
git range-diff --no-color main..topic main..unmodified \
613
613
>actual &&
614
614
sed s/Z/\ /g >expect <<-EOF &&
@@ -630,9 +630,9 @@ test_expect_success 'range-diff compares notes by default' '
630
630
'
631
631
632
632
test_expect_success ' range-diff with --no-notes' '
633
+ test_when_finished "git notes remove topic unmodified || :" &&
633
634
git notes add -m "topic note" topic &&
634
635
git notes add -m "unmodified note" unmodified &&
635
- test_when_finished git notes remove topic unmodified &&
636
636
git range-diff --no-color --no-notes main..topic main..unmodified \
637
637
>actual &&
638
638
cat >expect <<-EOF &&
@@ -645,12 +645,12 @@ test_expect_success 'range-diff with --no-notes' '
645
645
'
646
646
647
647
test_expect_success ' range-diff with multiple --notes' '
648
+ test_when_finished "git notes --ref=note1 remove topic unmodified || :" &&
648
649
git notes --ref=note1 add -m "topic note1" topic &&
649
650
git notes --ref=note1 add -m "unmodified note1" unmodified &&
650
- test_when_finished git notes --ref=note1 remove topic unmodified &&
651
+ test_when_finished " git notes --ref=note2 remove topic unmodified || :" &&
651
652
git notes --ref=note2 add -m "topic note2" topic &&
652
653
git notes --ref=note2 add -m "unmodified note2" unmodified &&
653
- test_when_finished git notes --ref=note2 remove topic unmodified &&
654
654
git range-diff --no-color --notes=note1 --notes=note2 main..topic main..unmodified \
655
655
>actual &&
656
656
sed s/Z/\ /g >expect <<-EOF &&
@@ -678,25 +678,25 @@ test_expect_success 'range-diff with multiple --notes' '
678
678
679
679
# `range-diff` should act like `log` with regards to notes
680
680
test_expect_success ' range-diff with --notes=custom does not show default notes' '
681
+ test_when_finished "git notes remove topic unmodified || :" &&
681
682
git notes add -m "topic note" topic &&
682
683
git notes add -m "unmodified note" unmodified &&
684
+ test_when_finished "git notes --ref=custom remove topic unmodified || :" &&
683
685
git notes --ref=custom add -m "topic note" topic &&
684
686
git notes --ref=custom add -m "unmodified note" unmodified &&
685
- test_when_finished git notes remove topic unmodified &&
686
- test_when_finished git notes --ref=custom remove topic unmodified &&
687
687
git range-diff --notes=custom main..topic main..unmodified \
688
688
>actual &&
689
689
! grep "## Notes ##" actual &&
690
690
grep "## Notes (custom) ##" actual
691
691
'
692
692
693
693
test_expect_success ' format-patch --range-diff does not compare notes by default' '
694
+ test_when_finished "git notes remove topic unmodified || :" &&
694
695
git notes add -m "topic note" topic &&
695
696
git notes add -m "unmodified note" unmodified &&
696
- test_when_finished git notes remove topic unmodified &&
697
+ test_when_finished "rm -f 000?-*" &&
697
698
git format-patch --cover-letter --range-diff=$prev \
698
699
main..unmodified >actual &&
699
- test_when_finished "rm 000?-*" &&
700
700
test_line_count = 5 actual &&
701
701
test_grep "^Range-diff:$" 0000-* &&
702
702
grep "= 1: .* s/5/A" 0000-* &&
@@ -708,26 +708,26 @@ test_expect_success 'format-patch --range-diff does not compare notes by default
708
708
'
709
709
710
710
test_expect_success ' format-patch --notes=custom --range-diff only compares custom notes' '
711
+ test_when_finished "git notes remove topic unmodified || :" &&
711
712
git notes add -m "topic note" topic &&
712
- git notes --ref=custom add -m "topic note (custom)" topic &&
713
713
git notes add -m "unmodified note" unmodified &&
714
+ test_when_finished "git notes --ref=custom remove topic unmodified || :" &&
715
+ git notes --ref=custom add -m "topic note (custom)" topic &&
714
716
git notes --ref=custom add -m "unmodified note (custom)" unmodified &&
715
- test_when_finished git notes remove topic unmodified &&
716
- test_when_finished git notes --ref=custom remove topic unmodified &&
717
+ test_when_finished "rm -f 000?-*" &&
717
718
git format-patch --notes=custom --cover-letter --range-diff=$prev \
718
719
main..unmodified >actual &&
719
- test_when_finished "rm 000?-*" &&
720
720
grep "## Notes (custom) ##" 0000-* &&
721
721
! grep "## Notes ##" 0000-*
722
722
'
723
723
724
724
test_expect_success ' format-patch --range-diff with --no-notes' '
725
+ test_when_finished "git notes remove topic unmodified || :" &&
725
726
git notes add -m "topic note" topic &&
726
727
git notes add -m "unmodified note" unmodified &&
727
- test_when_finished git notes remove topic unmodified &&
728
+ test_when_finished "rm -f 000?-*" &&
728
729
git format-patch --no-notes --cover-letter --range-diff=$prev \
729
730
main..unmodified >actual &&
730
- test_when_finished "rm 000?-*" &&
731
731
test_line_count = 5 actual &&
732
732
test_grep "^Range-diff:$" 0000-* &&
733
733
grep "= 1: .* s/5/A" 0000-* &&
@@ -739,12 +739,12 @@ test_expect_success 'format-patch --range-diff with --no-notes' '
739
739
'
740
740
741
741
test_expect_success ' format-patch --range-diff with --notes' '
742
+ test_when_finished "git notes remove topic unmodified || :" &&
742
743
git notes add -m "topic note" topic &&
743
744
git notes add -m "unmodified note" unmodified &&
744
- test_when_finished git notes remove topic unmodified &&
745
+ test_when_finished "rm -f 000?-*" &&
745
746
git format-patch --notes --cover-letter --range-diff=$prev \
746
747
main..unmodified >actual &&
747
- test_when_finished "rm 000?-*" &&
748
748
test_line_count = 5 actual &&
749
749
test_grep "^Range-diff:$" 0000-* &&
750
750
grep "= 1: .* s/5/A" 0000-* &&
@@ -767,13 +767,13 @@ test_expect_success 'format-patch --range-diff with --notes' '
767
767
'
768
768
769
769
test_expect_success ' format-patch --range-diff with format.notes config' '
770
+ test_when_finished "git notes remove topic unmodified || :" &&
770
771
git notes add -m "topic note" topic &&
771
772
git notes add -m "unmodified note" unmodified &&
772
- test_when_finished git notes remove topic unmodified &&
773
773
test_config format.notes true &&
774
+ test_when_finished "rm -f 000?-*" &&
774
775
git format-patch --cover-letter --range-diff=$prev \
775
776
main..unmodified >actual &&
776
- test_when_finished "rm 000?-*" &&
777
777
test_line_count = 5 actual &&
778
778
test_grep "^Range-diff:$" 0000-* &&
779
779
grep "= 1: .* s/5/A" 0000-* &&
@@ -796,15 +796,15 @@ test_expect_success 'format-patch --range-diff with format.notes config' '
796
796
'
797
797
798
798
test_expect_success ' format-patch --range-diff with multiple notes' '
799
+ test_when_finished "git notes --ref=note1 remove topic unmodified || :" &&
799
800
git notes --ref=note1 add -m "topic note1" topic &&
800
801
git notes --ref=note1 add -m "unmodified note1" unmodified &&
801
- test_when_finished git notes --ref=note1 remove topic unmodified &&
802
+ test_when_finished " git notes --ref=note2 remove topic unmodified || :" &&
802
803
git notes --ref=note2 add -m "topic note2" topic &&
803
804
git notes --ref=note2 add -m "unmodified note2" unmodified &&
804
- test_when_finished git notes --ref=note2 remove topic unmodified &&
805
+ test_when_finished "rm -f 000?-*" &&
805
806
git format-patch --notes=note1 --notes=note2 --cover-letter --range-diff=$prev \
806
807
main..unmodified >actual &&
807
- test_when_finished "rm 000?-*" &&
808
808
test_line_count = 5 actual &&
809
809
test_grep "^Range-diff:$" 0000-* &&
810
810
grep "= 1: .* s/5/A" 0000-* &&
0 commit comments