@@ -757,6 +757,76 @@ test_expect_success 'format-patch --notes --signoff' '
757757 sed "1,/^---$/d" out | grep "test message"
758758'
759759
760+ test_expect_success ' format-patch notes output control' '
761+ git notes add -m "notes config message" HEAD &&
762+ test_when_finished git notes remove HEAD &&
763+
764+ git format-patch -1 --stdout >out &&
765+ ! grep "notes config message" out &&
766+ git format-patch -1 --stdout --notes >out &&
767+ grep "notes config message" out &&
768+ git format-patch -1 --stdout --no-notes >out &&
769+ ! grep "notes config message" out &&
770+ git format-patch -1 --stdout --notes --no-notes >out &&
771+ ! grep "notes config message" out &&
772+ git format-patch -1 --stdout --no-notes --notes >out &&
773+ grep "notes config message" out &&
774+
775+ test_config format.notes standard &&
776+ git format-patch -1 --stdout >out &&
777+ grep "notes config message" out &&
778+ git format-patch -1 --stdout --notes >out &&
779+ grep "notes config message" out &&
780+ git format-patch -1 --stdout --no-notes >out &&
781+ ! grep "notes config message" out &&
782+ git format-patch -1 --stdout --notes --no-notes >out &&
783+ ! grep "notes config message" out &&
784+ git format-patch -1 --stdout --no-notes --notes >out &&
785+ grep "notes config message" out
786+ '
787+
788+ test_expect_success ' format-patch with multiple notes refs' '
789+ git notes --ref note1 add -m "this is note 1" HEAD &&
790+ test_when_finished git notes --ref note1 remove HEAD &&
791+ git notes --ref note2 add -m "this is note 2" HEAD &&
792+ test_when_finished git notes --ref note2 remove HEAD &&
793+
794+ git format-patch -1 --stdout >out &&
795+ ! grep "this is note 1" out &&
796+ ! grep "this is note 2" out &&
797+ git format-patch -1 --stdout --notes=note1 >out &&
798+ grep "this is note 1" out &&
799+ ! grep "this is note 2" out &&
800+ git format-patch -1 --stdout --notes=note2 >out &&
801+ ! grep "this is note 1" out &&
802+ grep "this is note 2" out &&
803+ git format-patch -1 --stdout --notes=note1 --notes=note2 >out &&
804+ grep "this is note 1" out &&
805+ grep "this is note 2" out &&
806+
807+ test_config format.notes note1 &&
808+ git format-patch -1 --stdout >out &&
809+ grep "this is note 1" out &&
810+ ! grep "this is note 2" out &&
811+ git format-patch -1 --stdout --no-notes >out &&
812+ ! grep "this is note 1" out &&
813+ ! grep "this is note 2" out &&
814+ git format-patch -1 --stdout --notes=note2 >out &&
815+ grep "this is note 1" out &&
816+ grep "this is note 2" out &&
817+ git format-patch -1 --stdout --no-notes --notes=note2 >out &&
818+ ! grep "this is note 1" out &&
819+ grep "this is note 2" out &&
820+
821+ git config --add format.notes note2 &&
822+ git format-patch -1 --stdout >out &&
823+ grep "this is note 1" out &&
824+ grep "this is note 2" out &&
825+ git format-patch -1 --stdout --no-notes >out &&
826+ ! grep "this is note 1" out &&
827+ ! grep "this is note 2" out
828+ '
829+
760830echo " fatal: --name-only does not make sense" > expect.name-only
761831echo " fatal: --name-status does not make sense" > expect.name-status
762832echo " fatal: --check does not make sense" > expect.check
0 commit comments