diff options
| author | alex <alex@pdp7.net> | 2026-03-22 19:56:56 +0100 |
|---|---|---|
| committer | alex <alex@pdp7.net> | 2026-03-22 20:02:43 +0100 |
| commit | 86de60ce63a5417fdf7660957668e763087eb27a (patch) | |
| tree | 1a1535dfe79c2d6382dea06fcf3e687e4c2d6897 | |
| parent | 9892218422884e2f06e8400966367f6241e5eff6 (diff) | |
Clean up worktreemaster
| -rwxr-xr-x | blog/post-receive | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/blog/post-receive b/blog/post-receive index 0721ce3b..f69abaf6 100755 --- a/blog/post-receive +++ b/blog/post-receive @@ -27,7 +27,9 @@ with tempfile.TemporaryDirectory() as tempdir: tempdir = pathlib.Path(tempdir) repo = tempdir / "repo" subprocess.run(["git", "worktree", "add", repo, pushed_commit], check=True) - blog = repo / "blog" - os.chdir(blog) - os.environ["PATH"] = "/home/alex/.local/bin:" + os.environ["PATH"] - subprocess.run(["./build.sh", dest], check=True) + try: + blog = repo / "blog" + os.environ["PATH"] = "/home/alex/.local/bin:" + os.environ["PATH"] + subprocess.run(["./build.sh", dest], check=True, cwd=blog) + finally: + subprocess.run(["git", "worktree", "remove", repo], check=True) |
