[PR #1706] [MERGED] fix: replace isomorphic-git status with direct git diff for worktree support #10032

Closed
opened 2026-02-16 18:14:35 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1706
Author: @ndraiman
Created: 8/8/2025
Status: Merged
Merged: 8/28/2025
Merged by: @adamdotdevin

Base: devHead: ndraiman/read-file-git-worktree


📝 Commits (2)

  • a8f8bf2 fix: replace isomorphic-git status with direct git diff for worktree support
  • 0996ec1 Merge branch 'dev' into ndraiman/read-file-git-worktree

📊 Changes

1 file changed (+2 additions, -7 deletions)

View changed files

📝 packages/opencode/src/file/index.ts (+2 -7)

📄 Description

Replace complex isomorphic-git status detection with direct git diff command to properly handle git worktrees.

At first, I tried detecting the git root dir using git rev-parse --git-dir and passing it as the gitDir arg to isomorphic-git
But git.status() returned incorrect status.

I saw that packages/opencode/src/file/index.ts already uses direct git commands in the status function,
so I updated the read function to do the same.

the git diff command works correctly in worktrees

Before:

image

After:

image

Closes https://github.com/sst/opencode/issues/891


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1706 **Author:** [@ndraiman](https://github.com/ndraiman) **Created:** 8/8/2025 **Status:** ✅ Merged **Merged:** 8/28/2025 **Merged by:** [@adamdotdevin](https://github.com/adamdotdevin) **Base:** `dev` ← **Head:** `ndraiman/read-file-git-worktree` --- ### 📝 Commits (2) - [`a8f8bf2`](https://github.com/anomalyco/opencode/commit/a8f8bf2847c68283379443d19446e479b6c73df2) fix: replace isomorphic-git status with direct git diff for worktree support - [`0996ec1`](https://github.com/anomalyco/opencode/commit/0996ec1c514e30164e58cd6098c5a1d3507c755e) Merge branch 'dev' into ndraiman/read-file-git-worktree ### 📊 Changes **1 file changed** (+2 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `packages/opencode/src/file/index.ts` (+2 -7) </details> ### 📄 Description Replace complex isomorphic-git status detection with direct git diff command to properly handle git worktrees. At first, I tried detecting the git root dir using `git rev-parse --git-dir` and passing it as the `gitDir` arg to `isomorphic-git` But `git.status()` returned incorrect status. I saw that `packages/opencode/src/file/index.ts` already uses direct `git` commands in the `status` function, so I updated the read function to do the same. the `git diff` command works correctly in worktrees Before: <img width="1204" height="73" alt="image" src="https://github.com/user-attachments/assets/dc2a25f7-fa33-4442-bdf1-5040cb684f0a" /> After: <img width="1724" height="381" alt="image" src="https://github.com/user-attachments/assets/68b9681f-d1c2-47e2-a718-5aa0c76123b1" /> Closes https://github.com/sst/opencode/issues/891 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:35 -05:00
yindo closed this issue 2026-02-16 18:14:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10032