Skip to content

fix(opencode): normalize subdirectory git paths#25631

Closed
mrbob-git wants to merge 1 commit into
anomalyco:devfrom
mrbob-git:mrbob/fix-issue-25593-cannot-review-files-changed-in-a
Closed

fix(opencode): normalize subdirectory git paths#25631
mrbob-git wants to merge 1 commit into
anomalyco:devfrom
mrbob-git:mrbob/fix-issue-25593-cannot-review-files-changed-in-a

Conversation

@mrbob-git
Copy link
Copy Markdown

Issue for this PR

Closes #25593

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When opencode is opened from a subdirectory, Git can report paths relative to the repo root. The review UI then tries to read those paths relative to the opened directory and fails.

This normalizes Git status/diff/stat paths to the active directory, reads git show targets relative to the active directory, and keeps batched patch keys aligned with the normalized file paths.

How did you verify your code works?

From packages/opencode:

  • bun test --timeout 30000 test/git/git.test.ts -t "show\(\) reads files relative to a subdirectory|status\(\) handles special filenames|diff\(\), stats\(\), and mergeBase|patch\(\) returns capped|show\(\) returns empty text for binary blobs"
  • bun test --timeout 30000 test/project/vcs.test.ts -t "diff\('git'\) returns paths relative to the active subdirectory|diff\('git'\) returns uncommitted changes|diff\('git'\) keeps batched patches aligned"
  • bun test --timeout 30000 test/file/index.test.ts -t "detects modified file|detects modified files relative to a subdirectory|detects untracked file as added|detects deleted file|detects mixed changes|returns empty for non-git project|returns diff and patch for modified tracked file"

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 3, 2026

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR (excluding the current PR #25631):

Related PR:

However, this is an older feature PR from a different context. The current PR #25631 appears to be the only active PR directly addressing the git path normalization issue for subdirectories (issue #25593).

No duplicate PRs found

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot review files changed in a subfolder of a monorepo

1 participant