Fix sidecar: advance refs/heads/main after each commit
post-receive uses `git checkout -f <SHA>` which detaches HEAD in the bare repo. Without this fix, sidecar commits advance the detached HEAD but not refs/heads/main and are orphaned on the next push. Also commits CLAUDE.md docs update and the retry-loop sync-vps.sh.
This commit is contained in:
@@ -133,6 +133,16 @@ async def _git_commit(file_path: Path, handle: str, verb: str) -> None:
|
||||
stderr=asyncio.subprocess.DEVNULL,
|
||||
)
|
||||
await commit.wait()
|
||||
# post-receive uses `git checkout -f <SHA>` which detaches HEAD, so
|
||||
# commits would advance the detached HEAD but not refs/heads/main and
|
||||
# would be lost on the next push. Explicitly keep main up to date.
|
||||
update_ref = await asyncio.create_subprocess_exec(
|
||||
"git", "update-ref", "refs/heads/main", "HEAD",
|
||||
cwd=str(_ROOT), env=env,
|
||||
stdout=asyncio.subprocess.DEVNULL,
|
||||
stderr=asyncio.subprocess.DEVNULL,
|
||||
)
|
||||
await update_ref.wait()
|
||||
except Exception as e:
|
||||
print(f"[git] commit failed for {rel}: {e}", flush=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user