opencode
opencode copied to clipboard
Fix relative paths for getGitFiles
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.
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.