Repository navigation
Conversation
…450) check-worktree.sh derived a 'primary path' from the script's own location and compared it against every entry of `git worktree list`. That entry set always contains the worktree the caller is standing in, so the comparison matched unconditionally and every worktree commit printed 'WARNING: On branch X in the primary checkout' - masking the one condition worth flagging. Compare --absolute-git-dir against --git-common-dir instead: identical only in the primary checkout, distinct in a linked worktree. This also removes the word-splitting loop, so paths containing spaces no longer break detection. The new tests immediately caught a second latent defect: GREEN was never defined, so the success path died under 'set -u' with 'GREEN: unbound variable'. A broken detector had hidden an unreachable success path. Closes #450
- frappe-500-after-restart-db-grant: a site 500s after a container restart because its DB user was granted for one container IP; diagnose from the backend log, fix the grant for '%'. - bitwarden-cli-serves-stale-cache: bw list answers from its local cache even while locked, so 'not in the vault' can be a wrong conclusion drawn from data older than the change being investigated; lastSync is the only freshness signal. Container addresses in the first entry use RFC 5737 documentation ranges.
A route declaring handler: redirect only ever carried its raw extra lines through the generic 'extra is defined' branch. Give redirects their own branch so the intent is explicit and a future edit to the generic branch cannot silently drop them. No change to rendered output: the live deployed Caddyfile is byte-identical to this template's render.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #450
What
bin/check-worktree.shreported "in the primary checkout" from inside every linked worktree, so the guard's only meaningful signal — the primary checkout having drifted offmain— was buried under noise that fired on every legitimate commit.Root cause
REPO_ROOTwas derived from the script's own location and reused asPRIMARY_PATH, then compared against each entry ofgit worktree list. That list always contains the worktree the caller is standing in, so the comparison matched unconditionally andIS_PRIMARY=1was guaranteed.The fix compares
git rev-parse --absolute-git-dirwith--git-common-dir: identical only in the primary checkout, distinct (<common>/worktrees/<name>) in a linked worktree. The word-splittingfor line in $WORKTREE_LISTloop goes away with it, so checkout paths containing spaces no longer break detection.A second defect the new tests found
GREENwas never defined in the script's colour block, so the success path —OK: In worktree '<path>' on branch '<branch>'— died underset -uwithGREEN: unbound variable, exit 1. It had never been reached, because the broken detector always took the warning branch. One bug was hiding the other; fixing detection alone would have turned "false warning" into "fails on every legitimate commit".Tests
New
tests/test_check_worktree.py, 8 cases built on real repositories (stubbing git would have reproduced the bug's assumptions rather than catching them):mainmain,--allow-mainmainmainwarningFull suite: 1716 passed, 1 skipped.
Also in this branch
Two commits carried over from session work that would otherwise have been left uncommitted in the primary checkout — which is the very state this script exists to prevent:
docs(kb)— two findings that cost real diagnostic time: a Frappe site 500ing because its DB user was granted for a single container IP, and the Bitwarden CLI answeringbw listfrom a local cache while locked, which can turn "not in the vault" into a confidently wrong answer. Container addresses use RFC 5737 documentation ranges.fix(ansible)— renderhandler: redirectroutes through their own branch in the Caddyfile template. No rendered-output change: the live deployed config is byte-identical to this template's render.Deliberately not included: uncommitted edits to
bin/bwunlock.shin the primary checkout, which belong to another session still in flight there.