#!/usr/bin/env python3
"""Create a committed README and 40 x 100 MB untracked random files.
Usage: seed.py workspace [source-workspace-to-copy-identical-bytes]
"""
import pathlib,subprocess,sys,os
p=pathlib.Path(sys.argv[1]);p.mkdir()
(p/'README.md').write_text('# Slow workspace reproduction\n')
subprocess.run(['git','init','-q','-b','main',str(p)],check=True)
subprocess.run(['git','-C',str(p),'add','README.md'],check=True)
subprocess.run(['git','-C',str(p),'-c','user.name=Evidence','-c','user.email=evidence@example.invalid','commit','-qm','Initial README'],check=True)
for n in range(40):
 name=f'random-{n:02d}.bin'
 if len(sys.argv)>2:subprocess.run(['cp','--reflink=auto',str(pathlib.Path(sys.argv[2])/name),str(p/name)],check=True)
 else:
  with (p/name).open('wb') as f:
   for _ in range(10):f.write(os.urandom(10_000_000))
print('Seeded 4 GB of untracked random files; no staging calibration was run here.')
