(git_root, run_dir)
| 7 | |
| 8 | |
| 9 | def pack_code(git_root, run_dir): |
| 10 | if os.path.isdir(f"{git_root}/.git"): |
| 11 | subprocess.run( |
| 12 | ['git', 'archive', '-o', f"{run_dir}/code.tar.gz", 'HEAD'], |
| 13 | check=True, |
| 14 | ) |
| 15 | diff_process = subprocess.run( |
| 16 | ['git', 'diff', 'HEAD'], |
| 17 | check=True, stdout=subprocess.PIPE, text=True, |
| 18 | ) |
| 19 | if diff_process.stdout: |
| 20 | logger.warning('Working tree is dirty. Patch:\n%s', diff_process.stdout) |
| 21 | with open(f"{run_dir}/dirty.patch", 'w') as f: |
| 22 | f.write(diff_process.stdout) |
| 23 | else: |
| 24 | logger.warning('.git does not exist in current dir') |
nothing calls this directly
no outgoing calls
no test coverage detected