Skip to content

Conversation

ndraiman
Copy link
Contributor

@ndraiman ndraiman commented Aug 8, 2025

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 #891

…support

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

fix
@ndraiman ndraiman force-pushed the ndraiman/read-file-git-worktree branch from 64f40b8 to a8f8bf2 Compare August 8, 2025 16:07
@adamdotdevin adamdotdevin requested a review from thdxr August 13, 2025 12:17
@adamdotdevin adamdotdevin merged commit 7fab12d into sst:dev Aug 28, 2025
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.

/files throws error upon selecting a file if you are in a git worktree
3 participants