from pathlib import Path
import sys
import subprocess
p=Path(sys.argv[1])
p.mkdir(exist_ok=True)
(p/'entry.txt').write_text('old\n')
(p/'other.txt').write_text('other\n')
subprocess.run(['tar','--format=ustar','-cf','revision.tar','entry.txt','other.txt'],cwd=p,check=True)
(p/'entry.txt').unlink()
(p/'entry.txt').symlink_to('other.txt')
subprocess.run(['tar','--format=ustar','-rf','revision.tar','entry.txt'],cwd=p,check=True)
subprocess.run(['git','init','-q'],cwd=p,check=True)
