Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

slab/menuband: fix mirror-sync false positive — pipefail + grep -q SIGPIPE

`set -o pipefail` made the per-iteration `git log … | grep -Fxq` pipeline
fail with exit 141 when grep -q exited early on a match, since git log
got SIGPIPE'd. The `! grep` then read failure as "no match" and falsely
flagged a landed contributor commit as unlanded.

Cache the landed subjects once into a variable, switch to here-string
match. Same fix in mirror-pull.sh.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+15 -5
+5 -1
slab/menuband/bin/mirror-pull.sh
··· 78 78 fi 79 79 say "last sync point: $(git log -1 --format='%h %s' "${LAST_MIRROR_COMMIT}")" 80 80 81 + # Cache the monorepo's landed subjects once (avoid per-iteration pipe — see 82 + # mirror-sync.sh for the pipefail+grep -q SIGPIPE trap that bit us). 83 + LANDED_SUBJECTS="$(git log --format='%s' -- "${PREFIX}")" 84 + 81 85 # Collect contributor commits in chronological order. Skip merges (format-patch 82 86 # can't represent them anyway) and our own snapshot commits. 83 87 CONTRIB_SHAS=() ··· 85 89 [[ -z "${contrib_sha}" ]] && continue 86 90 [[ "${contrib_subj}" == "Mirror of "* ]] && continue 87 91 # Skip if subject already exists in monorepo's slab/menuband history. 88 - if git log --format='%s' -- "${PREFIX}" | grep -Fxq "${contrib_subj}"; then 92 + if grep -Fxq -- "${contrib_subj}" <<< "${LANDED_SUBJECTS}"; then 89 93 continue 90 94 fi 91 95 CONTRIB_SHAS+=("${contrib_sha}")
+10 -4
slab/menuband/bin/mirror-sync.sh
··· 102 102 LAST_MIRROR_MONO_HASH="$(git -C "${WORK}" log -1 --format='%s' "${LAST_MIRROR_COMMIT}" \ 103 103 | sed -nE 's/^Mirror of ([0-9a-f]+):.*/\1/p')" 104 104 105 + # Cache the monorepo's landed subjects once. We can't pipe directly into 106 + # `grep -Fxq` per-iteration: with `set -o pipefail`, grep -q exits early 107 + # on first match, git log catches SIGPIPE → exit 141, and the pipeline 108 + # reports failure even though the match succeeded. Cache + here-string 109 + # avoids the pipe entirely. 110 + LANDED_SUBJECTS="$(git log --format='%s' -- "${PREFIX}")" 111 + 105 112 UNLANDED_COUNT=0 106 113 UNLANDED_LINES="" 107 114 while IFS=$'\t' read -r contrib_sha contrib_subj; do 108 115 [[ -z "${contrib_sha}" ]] && continue 109 116 # Skip future "Mirror of …" snapshots — those are our own. 110 117 [[ "${contrib_subj}" == "Mirror of "* ]] && continue 111 - # Has this subject appeared in the monorepo's slab/menuband history 112 - # since the last sync? If yes, treat as landed (authorship/hash differ 113 - # because of git am rewrites, but the content is what matters). 114 - if ! git log --format='%s' -- "${PREFIX}" | grep -Fxq "${contrib_subj}"; then 118 + # Treat as landed (authorship/hash differ because of git am rewrites, 119 + # but subject is the stable identity). 120 + if ! grep -Fxq -- "${contrib_subj}" <<< "${LANDED_SUBJECTS}"; then 115 121 UNLANDED_COUNT=$((UNLANDED_COUNT + 1)) 116 122 UNLANDED_LINES+=" ${contrib_sha:0:9} ${contrib_subj}"$'\n' 117 123 fi