bin/_common.sh: don't SIGPIPE git when finding the main checkout

`git worktree list --porcelain | awk '...{print $2; exit}'` exits after
the first line; with 27 worktrees git is still writing, gets SIGPIPE, and
under `set -o pipefail` every bin/ helper (deploy, vault-run, worktree)
exited 141 with no output. Let awk read to the end instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-11 08:34:30 -07:00
1 parent 310e5523f1
commit 420df90827
1 file changed
+3 -1
+3 -1
View File
@@ -1,7 +1,9 @@
# Shared by the bin/ helpers. The main checkout holds the venv and the # Shared by the bin/ helpers. The main checkout holds the venv and the
# (gitignored) vault files that every worktree uses. # (gitignored) vault files that every worktree uses.
repo=$(git rev-parse --show-toplevel) repo=$(git rev-parse --show-toplevel)
main_checkout=$(git -C "$repo" worktree list --porcelain | awk '/^worktree /{print $2; exit}') # awk reads to the end: exiting early kills git with SIGPIPE, which pipefail
# turns into a failed script once there are enough worktrees.
main_checkout=$(git -C "$repo" worktree list --porcelain | awk '/^worktree /&&!found{print $2; found=1}')
lock_dir=${XDG_RUNTIME_DIR:-/tmp}/ansible-selfhosting lock_dir=${XDG_RUNTIME_DIR:-/tmp}/ansible-selfhosting
mkdir -p "$lock_dir" && chmod 700 "$lock_dir" mkdir -p "$lock_dir" && chmod 700 "$lock_dir"