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