Skip to content

fix(diff): run remote diff git commands from repo root for monorepo subpaths#451

Merged
matt2e merged 2 commits intomainfrom
remote-diffs-2
Mar 24, 2026
Merged

fix(diff): run remote diff git commands from repo root for monorepo subpaths#451
matt2e merged 2 commits intomainfrom
remote-diffs-2

Conversation

@matt2e
Copy link
Contributor

@matt2e matt2e commented Mar 24, 2026

Summary

  • Fix remote diff commands to run from the repo root instead of the monorepo subpath, so git diff pathspecs and git show tree paths resolve correctly
  • Extract resolve_branch_clone_dir helper to deduplicate the repo-root resolution logic shared between branches and diff commands

Test plan

  • Verify remote diffs work correctly for repos with monorepo subpaths
  • Verify remote diffs still work for repos without subpaths

🤖 Generated with Claude Code

matt2e and others added 2 commits March 24, 2026 13:18
…ubpaths

Remote diffs showed no highlighted changes for monorepo subpath branches
because `git diff -- <path>` resolved pathspecs relative to CWD (the
subpath), doubling the path prefix. Fix by deriving just the clone
directory for `resolve_branch_context` so all remote diff commands run
from the repo root, making path resolution consistent across
`diff --name-status`, `show <ref>:<path>`, and `diff -- <path>`.

Also removes legacy `repo:` / `repos/` subpath format handling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e repo-root logic

The clone-dir derivation was duplicated between resolve_branch_context
in diff_commands.rs and resolve_branch_workspace_subpath in branches.rs.
Extract a shared resolve_branch_clone_dir helper so both call sites
use the same code path and stay in sync if the logic ever changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@matt2e matt2e requested review from baxen and wesbillman as code owners March 24, 2026 02:42
@matt2e matt2e merged commit 32465bb into main Mar 24, 2026
3 checks passed
@matt2e matt2e deleted the remote-diffs-2 branch March 24, 2026 02:43
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 21d2e22257

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 306 to 307
let workspace_path = match &repo.subpath {
Some(subpath) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve legacy subpath formats when resolving workspace paths

resolve_branch_workspace_subpath now always builds home:{clone_dir}/{subpath} and no longer recognizes legacy stored subpath formats (repo:<dir> / repos/...) that older project rows can still contain. For upgraded users with those rows, this returns a different directory than before (for example home:g2/repo:legacy), so downstream callers that execute git with -C against this path (e.g. workspace startup and remote branch operations) will fail to find the repository. Please keep the backward-compat parsing or migrate existing records before this path construction.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant