@@ -488,6 +488,14 @@ function () {
488488 function () {
489489 }
490490 ];
491+ yield 'dont-enforce_capitalized_subject_amend ' => [
492+ [
493+ 'enforce_capitalized_subject ' => true ,
494+ ],
495+ self ::mockCommitMsgContext (self ::amend ('no capital subject ' )),
496+ function () {
497+ }
498+ ];
491499 yield 'enforce_capitalized_subject_special_utf8_char ' => [
492500 [
493501 'enforce_capitalized_subject ' => true ,
@@ -560,6 +568,14 @@ function () {
560568 function () {
561569 }
562570 ];
571+ yield 'enforce_text_with_special_prefix_amend ' => [
572+ [
573+ 'max_subject_width ' => 10 ,
574+ ],
575+ self ::mockCommitMsgContext (self ::amend ('123456789 ' )),
576+ function () {
577+ }
578+ ];
563579 yield 'enforce_text_with_ignore_below_comment ' => [
564580 [
565581 'enforce_single_lined_subject ' => false ,
@@ -688,6 +704,38 @@ function () {
688704 function () {
689705 },
690706 ];
707+ yield 'amend_type_scope_conventions_match_type_without_scope ' => [
708+ [
709+ 'enforce_capitalized_subject ' => false ,
710+ 'type_scope_conventions ' => [
711+ 'types ' => [
712+ 'fix '
713+ ],
714+ 'scopes ' => [
715+ 'app '
716+ ]
717+ ],
718+ ],
719+ self ::mockCommitMsgContext (self ::amend ('fix: match type scope convention ' )),
720+ function () {
721+ },
722+ ];
723+ yield 'amend_type_scope_conventions_match_type_with_scope ' => [
724+ [
725+ 'enforce_capitalized_subject ' => false ,
726+ 'type_scope_conventions ' => [
727+ 'types ' => [
728+ 'fix '
729+ ],
730+ 'scopes ' => [
731+ 'app '
732+ ]
733+ ],
734+ ],
735+ self ::mockCommitMsgContext (self ::amend ('fix(app): match type scope convention ' )),
736+ function () {
737+ },
738+ ];
691739 yield 'skip_type_scope_conventions_on_merge ' => [
692740 [
693741 'enforce_capitalized_subject ' => false ,
@@ -947,4 +995,15 @@ private static function squash(string ... $messages): string
947995 ...$ messages
948996 );
949997 }
998+
999+ private static function amend (string ... $ messages ): string
1000+ {
1001+ $ subject = array_shift ($ messages );
1002+
1003+ return self ::buildMessage (
1004+ 'amend! ' .$ subject ,
1005+ '# This was created by running git commit --fixup=amend:... ' ,
1006+ ...$ messages
1007+ );
1008+ }
9501009}
0 commit comments