@@ -845,6 +845,111 @@ test_expect_success 'format-patch --range-diff with multiple notes' '
845845 test_cmp expect actual
846846'
847847
848+ test_expect_success ' format-patch --range-diff --notes=custom --no-range-diff-notes' '
849+ test_when_finished "git notes --ref=custom remove topic unmodified || :" &&
850+ git notes --ref=custom add -m "topic note1" topic &&
851+ git notes --ref=custom add -m "unmodified note1" unmodified &&
852+ test_when_finished "rm -f 000?-*" &&
853+ git format-patch --range-diff=$prev --notes=custom \
854+ --no-range-diff-notes --cover-letter \
855+ main..unmodified >actual &&
856+ test_grep "^Notes (custom):" 0004-* &&
857+ test_grep "^Range-diff:" 0000-cover-letter* &&
858+ test_grep ! "## Notes (custom) ##" 0000-cover-letter*
859+ '
860+
861+ test_expect_success ' format-patch --range-diff --range-diff-notes uses --notes behavior' '
862+ test_when_finished "git notes --ref=custom remove topic unmodified || :" &&
863+ git notes --ref=custom add -m "topic note1" topic &&
864+ git notes --ref=custom add -m "unmodified note1" unmodified &&
865+ test_when_finished "rm -f 000?-*" &&
866+ git format-patch --range-diff=$prev --notes=custom \
867+ --range-diff-notes --cover-letter \
868+ main..unmodified >actual &&
869+ test_grep "^Notes (custom):" 0004-* &&
870+ test_grep "^Range-diff:" 0000-cover-letter* &&
871+ test_grep "## Notes (custom) ##" 0000-cover-letter*
872+ '
873+
874+ test_expect_success ' format-patch --range-diff --notes=patch --range-diff-notes=rdiff' '
875+ test_when_finished "git notes --ref=patch remove topic unmodified || :" &&
876+ git notes --ref=patch add -m "only for patch 1" topic &&
877+ git notes --ref=patch add -m "only for patch 2" unmodified &&
878+ test_when_finished "git notes --ref=rdiff remove topic unmodified || :" &&
879+ git notes --ref=rdiff add -m "only for range diff 1" topic &&
880+ git notes --ref=rdiff add -m "only for range diff 2" unmodified &&
881+ test_when_finished "rm -f 000?-*" &&
882+ git format-patch --range-diff=$prev --notes=patch \
883+ --range-diff-notes=rdiff --cover-letter \
884+ main..unmodified >actual &&
885+ test_grep "^Notes (patch):" 0004-* &&
886+ test_grep ! "^Notes (rdiff):" 0004-* &&
887+ test_grep "^Range-diff:" 0000-cover-letter* &&
888+ test_grep "## Notes (rdiff) ##" 0000-cover-letter* &&
889+ test_grep ! "## Notes (patch) ##" 0000-cover-letter*
890+ '
891+
892+ test_expect_success ' format-patch --range-diff --no-range-diff-notes --range-diff-notes uses --notes behavior' '
893+ test_when_finished "git notes --ref=custom remove topic unmodified || :" &&
894+ git notes --ref=custom add -m "topic note1" topic &&
895+ git notes --ref=custom add -m "unmodified note1" unmodified &&
896+ test_when_finished "rm -f 000?-*" &&
897+ git format-patch --range-diff=$prev --notes=custom \
898+ --no-range-diff-notes --range-diff-notes --cover-letter \
899+ main..unmodified >actual &&
900+ test_grep "^Notes (custom):" 0004-* &&
901+ test_grep "^Range-diff:" 0000-cover-letter* &&
902+ test_grep "## Notes (custom) ##" 0000-cover-letter*
903+ '
904+
905+ test_expect_success ' format-patch --range-diff --range-diff-notes uses --notes behavior' '
906+ test_when_finished "git notes --ref=custom remove topic unmodified || :" &&
907+ git notes --ref=custom add -m "topic note1" topic &&
908+ git notes --ref=custom add -m "unmodified note1" unmodified &&
909+ test_when_finished "rm -f 000?-*" &&
910+ git format-patch --range-diff=$prev --notes=custom \
911+ --range-diff-notes --cover-letter \
912+ main..unmodified >actual &&
913+ test_grep "^Notes (custom):" 0004-* &&
914+ test_grep "^Range-diff:" 0000-cover-letter* &&
915+ test_grep "## Notes (custom) ##" 0000-cover-letter*
916+ '
917+
918+ test_expect_success ' format-patch --range-diff --no-range-diff-notes does not use default notes' '
919+ test_when_finished "git notes remove topic unmodified || :" &&
920+ git notes add -m "topic note1" topic &&
921+ git notes add -m "unmodified note1" unmodified &&
922+ test_when_finished "rm -f 000?-*" &&
923+ git format-patch --range-diff=$prev \
924+ --no-range-diff-notes --cover-letter \
925+ main..unmodified >actual &&
926+ test_grep ! "^Notes:" 0004-* &&
927+ test_grep "^Range-diff:" 0000-cover-letter* &&
928+ test_grep ! "## Notes ##" 0000-cover-letter*
929+ '
930+
931+ test_expect_success ' format-patch --range-diff --no-range-diff-notes on single patch' '
932+ test_when_finished "git notes --ref=custom remove HEAD unmodified || :" &&
933+ git notes --ref=custom add -m "topic note (custom)" HEAD &&
934+ git notes --ref=custom add -m "unmodified note (custom)" unmodified &&
935+ git format-patch --notes=custom --range-diff=$prev \
936+ --no-range-diff-notes -1 --stdout >actual &&
937+ test_grep "Notes (custom):" actual &&
938+ test_grep "^Range-diff:" actual &&
939+ test_grep ! "## Notes (custom) ##" actual
940+ '
941+
942+ test_expect_success ' format-patch --range-diff --range-diff-notes=custom on single patch' '
943+ test_when_finished "git notes --ref=custom remove HEAD unmodified || :" &&
944+ git notes --ref=custom add -m "topic note (custom)" HEAD &&
945+ git notes --ref=custom add -m "unmodified note (custom)" unmodified &&
946+ git format-patch --no-notes --range-diff=$prev \
947+ --range-diff-notes=custom -1 --stdout >actual &&
948+ test_grep ! "Notes (custom):" actual &&
949+ test_grep "^Range-diff:" actual &&
950+ test_grep "## Notes (custom) ##" actual
951+ '
952+
848953test_expect_success ' --left-only/--right-only' '
849954 git switch --orphan left-right &&
850955 test_commit first &&
0 commit comments