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