(tempdir_factory)
| 117 | |
| 118 | @pytest.fixture |
| 119 | def prepare_commit_msg_repo(tempdir_factory): |
| 120 | path = git_dir(tempdir_factory) |
| 121 | script_name = 'add_sign_off.sh' |
| 122 | config = { |
| 123 | 'repo': 'local', |
| 124 | 'hooks': [{ |
| 125 | 'id': 'add-signoff', |
| 126 | 'name': 'Add "Signed off by:"', |
| 127 | 'entry': f'./{script_name}', |
| 128 | 'language': 'script', |
| 129 | 'stages': ['prepare-commit-msg'], |
| 130 | }], |
| 131 | } |
| 132 | write_config(path, config) |
| 133 | with cwd(path): |
| 134 | with open(script_name, 'w') as script_file: |
| 135 | script_file.write( |
| 136 | '#!/usr/bin/env bash\n' |
| 137 | 'set -eu\n' |
| 138 | 'echo "\nSigned off by: " >> "$1"\n', |
| 139 | ) |
| 140 | make_executable(script_name) |
| 141 | cmd_output('git', 'add', '.') |
| 142 | git_commit(msg=prepare_commit_msg_repo.__name__) |
| 143 | yield path |
| 144 | |
| 145 | |
| 146 | @pytest.fixture |
nothing calls this directly
no test coverage detected