Expand description
Advisory lock for mutating a live session’s branch set.
git paw add and git paw remove both splice panes into / out of a
running tmux session and rewrite the session JSON. Two of these running
concurrently — or one racing a supervisor sweep that is itself sending
keys to panes — can corrupt the grid or the session receipt (design
“Risks / Trade-offs: Race: add/remove while a sweep is mutating panes”).
The mitigation is a single advisory lock file under the repo’s .git-paw/
directory, taken by both subcommands. It is advisory: it guards git-paw’s
own add/remove invocations against each other, not arbitrary external
tmux activity. Acquisition is an atomic create_new — the first caller
wins, a second concurrent caller gets a clear “operation in progress”
error rather than interleaving its mutations. The lock is released (file
removed) when the SessionLock guard drops, including on early-return
error paths.
Structs§
- Session
Lock - RAII guard for the add/remove advisory lock.
Constants§
- LOCK_
FILE_ NAME - File name of the add/remove advisory lock within
<repo>/.git-paw/.
Functions§
- lock_
path - Returns the advisory lock path for a repository:
<repo>/.git-paw/.add-remove.lock.