opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Fix relative paths for getGitFiles

Open calirvine opened this issue 4 months ago • 1 comments

Problem

When working in a large monorepo, sometimes we open opencode from a sub package rather than from the github repository root. If you select a file with @ files with git diffs will show at the top, but they are relative to the git repository root and not to the current working directory, so the file path that gets read is incorrect.

Fix

By using the relative path based on the working directory, opencode successfully reads the file from the git diff selection.

calirvine avatar Sep 29 '25 20:09 calirvine

This is something that annoyed me as I was playing around with opencode so I thought I would take a stab at fixing it, but maybe there's a perfectly good reason for it to be this way.

calirvine avatar Sep 29 '25 20:09 calirvine