(commit: "Commit")
| 60 | info = CommitInformation.from_sha(sha, cwd=cwd) |
| 61 | |
| 62 | def parser(commit: "Commit") -> Iterable[Scannable]: |
| 63 | for paths in batched(commit.info.paths, _MAX_DOCS_PER_COMMIT): |
| 64 | cmd = ["show", sha, *PATCH_COMMON_ARGS, "--"] |
| 65 | |
| 66 | # Append paths to the command-line. If the file has been renamed, append |
| 67 | # both old and new paths. If we only append the new path then `git |
| 68 | # show` returns the new path as an added file. |
| 69 | for path in paths: |
| 70 | if old_path := commit.info.renames.get(path): |
| 71 | cmd.append(str(old_path)) |
| 72 | cmd.append(str(path)) |
| 73 | |
| 74 | patch = git(cmd, cwd=cwd) |
| 75 | yield from parse_patch(sha, patch, exclusion_regexes) |
| 76 | |
| 77 | return Commit(sha, parser, info) |
| 78 |
nothing calls this directly
no test coverage detected