|
29 | 29 | from testing.util import cwd |
30 | 30 | from testing.util import git_commit |
31 | 31 | from testing.util import xfailif_no_symlink |
| 32 | +from testing.util import xfailif_windows |
32 | 33 |
|
33 | 34 |
|
34 | 35 | def test_is_not_script(): |
@@ -742,6 +743,33 @@ def test_prepare_commit_msg_legacy( |
742 | 743 | assert 'Signed off by: ' in f.read() |
743 | 744 |
|
744 | 745 |
|
| 746 | +@xfailif_windows # pragma: windows no cover (once AP has git 2.24) |
| 747 | +def test_pre_merge_commit_integration(tempdir_factory, store): |
| 748 | + expected = re.compile( |
| 749 | + r'^\[INFO\] Initializing environment for .+\n' |
| 750 | + r'Bash hook\.+Passed\n' |
| 751 | + r"Merge made by the 'recursive' strategy.\n" |
| 752 | + r' foo \| 0\n' |
| 753 | + r' 1 file changed, 0 insertions\(\+\), 0 deletions\(-\)\n' |
| 754 | + r' create mode 100644 foo\n$', |
| 755 | + ) |
| 756 | + |
| 757 | + path = make_consuming_repo(tempdir_factory, 'script_hooks_repo') |
| 758 | + with cwd(path): |
| 759 | + ret = install(C.CONFIG_FILE, store, hook_types=['pre-merge-commit']) |
| 760 | + assert ret == 0 |
| 761 | + |
| 762 | + cmd_output('git', 'checkout', 'master', '-b', 'feature') |
| 763 | + _get_commit_output(tempdir_factory) |
| 764 | + cmd_output('git', 'checkout', 'master') |
| 765 | + ret, output, _ = cmd_output_mocked_pre_commit_home( |
| 766 | + 'git', 'merge', '--no-ff', '--no-edit', 'feature', |
| 767 | + tempdir_factory=tempdir_factory, |
| 768 | + ) |
| 769 | + assert ret == 0 |
| 770 | + assert expected.match(output) |
| 771 | + |
| 772 | + |
745 | 773 | def test_install_disallow_missing_config(tempdir_factory, store): |
746 | 774 | path = make_consuming_repo(tempdir_factory, 'script_hooks_repo') |
747 | 775 | with cwd(path): |
|
0 commit comments