Explorar o código

fix: worktree file/content never includes patch

Adam hai 5 meses
pai
achega
f7ab6beaf3
Modificáronse 1 ficheiros con 2 adicións e 3 borrados
  1. 2 3
      packages/opencode/src/file/index.ts

+ 2 - 3
packages/opencode/src/file/index.ts

@@ -124,10 +124,9 @@ export namespace File {
       .catch(() => "")
       .catch(() => "")
       .then((x) => x.trim())
       .then((x) => x.trim())
     if (project.vcs === "git") {
     if (project.vcs === "git") {
-      const rel = path.relative(Instance.worktree, full)
-      const diff = await $`git diff ${rel}`.cwd(Instance.worktree).quiet().nothrow().text()
+      const diff = await $`git diff ${file}`.cwd(Instance.directory).quiet().nothrow().text()
       if (diff.trim()) {
       if (diff.trim()) {
-        const original = await $`git show HEAD:${rel}`.cwd(Instance.worktree).quiet().nothrow().text()
+        const original = await $`git show HEAD:${file}`.cwd(Instance.directory).quiet().nothrow().text()
         const patch = createPatch(file, original, content, "old", "new", {
         const patch = createPatch(file, original, content, "old", "new", {
           context: Infinity,
           context: Infinity,
         })
         })