MCPcopy Create free account
hub / github.com/binbinjiang/CVT-SLR / pack_code

Function pack_code

utils/pack_code.py:9–24  ·  view source on GitHub ↗
(git_root, run_dir)

Source from the content-addressed store, hash-verified

7
8
9def 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')

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected