Repository navigation
fix(review): a named directory is reviewed even when the shell exported GIT_DIR - #3377
Merged
Merged
Conversation
…ed GIT_DIR plannotator review <folder> run with GIT_DIR (or GIT_WORK_TREE) set by the calling shell, as in a git hook or a script, showed the diff of the repository those variables name instead of the folder's. The CLI now removes them once a directory is named, before any git runs; with no directory they still decide. The list moves to @plannotator/shared/child-env, shared with the Inbox's clone.
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.
What was wrong
plannotator review <folder>started from a shell that had exportedGIT_DIR(and maybeGIT_WORK_TREE) showed the diff of the repository those variables name, not the folder's. A git hook or a script sets them. WithGIT_DIRalone the page mixed the two: the other repository's index against the named folder's files. With both set, it showed only the other repository.The fix
Once the review names a directory, the CLI removes
GIT_DIRand its kin from its own environment before any git runs. That covers the directreviewcommand and the OpenCodeopencode-review-directorybridge, which shareresolveCliReviewDirectory. With no directory named, the variables still decide, soGIT_DIR=… GIT_WORK_TREE=… plannotator reviewkeeps working.The variable list moves to
@plannotator/shared/child-env(GIT_REPO_ENV). The Inbox's clone (inbox-launch-clone.ts) already removed the same list and now imports it.Pi is unchanged. Its
/plannotator-reviewruns inside Pi's own process, and that process's env is not Plannotator's to change.Other ways a review can show another project's changes (checked, not changed here)
These behave the same on 0.28.56 and on main:
review --diff-type uncommitted other-projectrun from inside a different repository. The current folder's repository is reviewed, and the only sign is a one-line stderr notice ("Ignoring words…"). This is the documented prose tolerance (fix(review): error loudly on unknown review options instead of silently dropping them #1483), andreview-args.test.tspins it. The help says "A sole word … is a directory target", which suggests an error instead.Flag order, absolute and relative paths, linked worktrees and submodules all review the named folder. A second review on a fixed port that is already in use exits with a clear message.
Tests
apps/hook/server/review-directory.test.ts, for the CLI and the OpenCode bridge:GIT_DIR, and withGIT_DIRplusGIT_WORK_TREE, exported;The new tests fail before the fix (they show the caller's repository) and pass after it.