Repository navigation
fix(source-control): run ready's branch update with --dir and git -C - #15946
Conversation
branch-update-signals.sh takes --dir <checkout>: git reads run there and the repository resolves with target-repo.sh (GH_REPO honored, --repo wins). Without --dir nothing changes. Ready 2.5.2 and the shared update sequence name <branch-checkout>, the checkout holding the branch, for push-branch.sh, resolve-remote.sh and the signals (--dir) and for the base fetch and merge, the fast-forward and the signed-head read (git -C), so a shell outside the checkout can run the step. The base-merge eval grader accepts git -C. Refs: #15900 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vcupomh2tPSB9BXCVa1AeL
|
PR body contract — issue linkage This PR body conforms to the issue-linkage contract. Nothing to do. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4be218995b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
claude-security-review reviewed Security review: PR #15946 (incremental, 4be2189 → a0f18d6)I found no security issues. This was an incremental review: I read every hunk of both files in scope (2 of 2) in What I checked
Blocking only: this lane already reviewed an earlier head, so this review was blocking only and would have dropped SUGGESTION findings. There were none. critical-findings: 0 |
|
claude-review reviewed Code review (incremental, blocking only): PR #15946 at
|
A relative --dir under an exported CDPATH resolved through it and cd printed the directory to stdout ahead of the JSON, breaking the pipe into branch-update-method.sh. Clear CDPATH and silence the cd, as pr-worktree.sh clears it, and test stdout is one JSON object. Refs: #15900 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vcupomh2tPSB9BXCVa1AeL
Refs: #15900
Summary
Item 1, option (a), of #15900: the owner decided that the pull-request scripts name the repository with
--dir <checkout>, not environment variables. This PR applies that to the last step that still ran from the shell's directory, ready's branch-update sequence (2.5.2). A caller with no--dirgets the same behavior as before.Fix
scripts/branch-update-signals.shtakes--dir <checkout>, asfetch-all-pr-comments.shandresolve-remote.shdo. Every git read (the base fetch, the overlap diff, the head checks) runs in that checkout, and the repository is resolved there withtarget-repo.sh, which honorsGH_REPO.--repostill wins. A missing, empty, repeated or non-directory--diris a usage error (exit 2). Iftarget-repo.shrefuses, its reason goes to stderr and every signal readsunknown, as any other failed read does. Without--dir, the script uses the shell's directory and gh's{owner}/{repo}placeholders, as before.ready-for-review.md, "Decide and carry out the update", defines<branch-checkout>: the path of the checkout that has the branch checked out. For a pull request, that is the worktreepr-worktree.sh --pr "$PR_NUMBER" --dir "<checkout>"prints. Step 2 used to say "from the PR's checkout"; it now says "in<branch-checkout>".push-branch.sh,resolve-remote.shandbranch-update-signals.shget--dir "<branch-checkout>", and the local merge fallback runsgit -C "<branch-checkout>" fetchandmerge. 2.5.2's skipped-step push and its completion check name it too.ready-for-review.md: the fast-forward after the forge's update and the signed-head read (cat-file commit HEAD) run withgit -C "<branch-checkout>".pull-request-ready-merges-base-never-rebasesgrader's merge regex also acceptsgit -C <dir> merge. Without that change, the docs' new command form would not count as a merge.<branch-checkout>is used rather than<checkout>because 2.5.3 lets<checkout>be any checkout of the repository, such as the main checkout. Merging the base there, or pushing that checkout's HEAD withpush-branch.sh --dir --pr, would land on the wrong branch.Fork checkouts
The repository a fork checkout resolves to in
readydoes not change. 2.5.1 exportsGH_REPOfromtarget-repo.sh --dir "<checkout>", and both the old placeholder path andtarget-repo.shfollowGH_REPO. Without--dir, the script works as before.Verification
branch-update-signals.test.sh: 410 passed, 0 failed. The new cases run from a shell outside every checkout. They cover:--dirreads the checkout's repository,head_shaand overlap; no--dirstill uses the placeholders;--repowins over--dir;GH_REPOwins with--dir;target-repo.shrefuses for two unrelated GitHub remotes; and four usage errors.reassess-state.test.sh(109),gh-forge.test.sh(83),ready-verify-local.test.sh(7) andready-flip.test.sh(59).shellcheck -xis clean on both changed scripts.check-affectedhook passed. Suites over the 120-second budget are left to CI.readyfrom outside a checkout against a real PR.Related
--dir.Remaining
babysit-prscomment fetches) is waiting on the owner's choice.create.mdplaceholder anchoring) is waiting on the owner's choice.<branch-checkout>. Item 1(a) named only the fetch, merge andcat-filelines.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vcupomh2tPSB9BXCVa1AeL