()
| 112 | |
| 113 | |
| 114 | def get_conflicted_files() -> set[str]: |
| 115 | logger.info('Checking merge-conflict files only.') |
| 116 | # Need to get the conflicted files from the MERGE_MSG because they could |
| 117 | # have resolved the conflict by choosing one side or the other |
| 118 | with open(os.path.join(get_git_dir('.'), 'MERGE_MSG'), 'rb') as f: |
| 119 | merge_msg = f.read() |
| 120 | merge_conflict_filenames = parse_merge_msg_for_conflicts(merge_msg) |
| 121 | |
| 122 | # This will get the rest of the changes made after the merge. |
| 123 | # If they resolved the merge conflict by choosing a mesh of both sides |
| 124 | # this will also include the conflicted files |
| 125 | tree_hash = cmd_output('git', 'write-tree')[1].strip() |
| 126 | merge_diff_filenames = zsplit( |
| 127 | cmd_output( |
| 128 | 'git', 'diff', '--name-only', '--no-ext-diff', '-z', |
| 129 | '-m', tree_hash, 'HEAD', 'MERGE_HEAD', '--', |
| 130 | )[1], |
| 131 | ) |
| 132 | return set(merge_conflict_filenames) | set(merge_diff_filenames) |
| 133 | |
| 134 | |
| 135 | def get_staged_files(cwd: str | None = None) -> list[str]: |
nothing calls this directly
no test coverage detected