@@ -759,6 +759,48 @@ def test_post_commit_integration(tempdir_factory, store):
759759 assert os .path .exists ('post-commit.tmp' )
760760
761761
762+ def test_post_merge_integration (tempdir_factory , store ):
763+ path = git_dir (tempdir_factory )
764+ config = [
765+ {
766+ 'repo' : 'local' ,
767+ 'hooks' : [{
768+ 'id' : 'post-merge' ,
769+ 'name' : 'Post merge' ,
770+ 'entry' : 'touch post-merge.tmp' ,
771+ 'language' : 'system' ,
772+ 'always_run' : True ,
773+ 'verbose' : True ,
774+ 'stages' : ['post-merge' ],
775+ }],
776+ },
777+ ]
778+ write_config (path , config )
779+ with cwd (path ):
780+ # create a simple diamond of commits for a non-trivial merge
781+ open ('init' , 'a' ).close ()
782+ cmd_output ('git' , 'add' , '.' )
783+ git_commit ()
784+
785+ open ('master' , 'a' ).close ()
786+ cmd_output ('git' , 'add' , '.' )
787+ git_commit ()
788+
789+ cmd_output ('git' , 'checkout' , '-b' , 'branch' , 'HEAD^' )
790+ open ('branch' , 'a' ).close ()
791+ cmd_output ('git' , 'add' , '.' )
792+ git_commit ()
793+
794+ cmd_output ('git' , 'checkout' , 'master' )
795+ install (C .CONFIG_FILE , store , hook_types = ['post-merge' ])
796+ retc , stdout , stderr = cmd_output_mocked_pre_commit_home (
797+ 'git' , 'merge' , 'branch' ,
798+ tempdir_factory = tempdir_factory ,
799+ )
800+ assert retc == 0
801+ assert os .path .exists ('post-merge.tmp' )
802+
803+
762804def test_post_checkout_integration (tempdir_factory , store ):
763805 path = git_dir (tempdir_factory )
764806 config = [
0 commit comments