Find the diff since the given SHA. Adapted from lint.py
(sha: str)
| 212 | |
| 213 | |
| 214 | def diff_files(sha: str) -> list[str]: |
| 215 | """Find the diff since the given SHA. |
| 216 | |
| 217 | Adapted from lint.py |
| 218 | """ |
| 219 | res = subprocess.run( |
| 220 | [ |
| 221 | "git", |
| 222 | "diff", |
| 223 | "--name-only", |
| 224 | "--diff-filter=ACMR", |
| 225 | "-z", |
| 226 | sha, |
| 227 | "--", |
| 228 | # Check against C_CPP_EXTENSIONS |
| 229 | "*.[chCH]", |
| 230 | "*.[ch]pp", |
| 231 | "*.[ch]xx", |
| 232 | "*.cc", |
| 233 | "*.hh", |
| 234 | ], |
| 235 | stdout=subprocess.PIPE, |
| 236 | encoding="utf-8", |
| 237 | ) |
| 238 | res.check_returncode() |
| 239 | return [f for f in res.stdout.split("\0") if f] |
| 240 | |
| 241 | |
| 242 | if __name__ == "__main__": |