diff options
| author | Netanel Draiman <[email protected]> | 2025-08-29 02:15:26 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-28 18:15:26 -0500 |
| commit | 7fab12da282ad6b4657ed7c9de46c2ac5125ae50 (patch) | |
| tree | 089040bb4a650aa569aa6af9bb09e9ab5f921923 | |
| parent | 6daf0fdb2b68bae213328c208fc8ba54944d561d (diff) | |
| download | opencode-7fab12da282ad6b4657ed7c9de46c2ac5125ae50.tar.gz opencode-7fab12da282ad6b4657ed7c9de46c2ac5125ae50.zip | |
fix: replace isomorphic-git status with direct git diff for worktree support (#1706)
Co-authored-by: Adam <[email protected]>
| -rw-r--r-- | packages/opencode/src/file/index.ts | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/packages/opencode/src/file/index.ts b/packages/opencode/src/file/index.ts index 40e0c2cfc..ea3f2d211 100644 --- a/packages/opencode/src/file/index.ts +++ b/packages/opencode/src/file/index.ts @@ -3,7 +3,6 @@ import { Bus } from "../bus" import { $ } from "bun" import { createPatch } from "diff" import path from "path" -import * as git from "isomorphic-git" import { App } from "../app/app" import fs from "fs" import ignore from "ignore" @@ -118,12 +117,8 @@ export namespace File { .then((x) => x.trim()) if (app.git) { const rel = path.relative(app.path.root, full) - const diff = await git.status({ - fs, - dir: app.path.root, - filepath: rel, - }) - if (diff !== "unmodified") { + const diff = await $`git diff ${rel}`.cwd(app.path.root).quiet().nothrow().text() + if (diff.trim()) { const original = await $`git show HEAD:${rel}`.cwd(app.path.root).quiet().nothrow().text() const patch = createPatch(file, original, content, "old", "new", { context: Infinity, |
