from pathlib import Path
import subprocess,sys
root=Path(sys.argv[1]); root.mkdir(parents=True,exist_ok=True)
def git(*args): subprocess.run(['git','-C',str(root),*args],check=True,capture_output=True)
git('init','-b','main'); (root/'README.md').write_text('# Branch action demo\nSynthetic reproduction project.\n'); git('add','.'); git('-c','user.name=Demo','-c','user.email=demo@example.invalid','commit','-m','Initial commit')
hook=root/'.git/hooks/post-checkout'; hook.write_text('#!/bin/sh\nsleep 10\nexit 0\n'); hook.chmod(0o755)
