summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIvan Starkov <[email protected]>2025-11-09 12:28:09 +0700
committerGitHub <[email protected]>2025-11-08 23:28:09 -0600
commit9637d704070782166a00262aa04b10353d2ebc03 (patch)
tree79ddae4657227853a3f9c910505569f62c0a4ced
parentcfbbdc2e14099de6994a07514cca94d97a51662d (diff)
downloadopencode-9637d704070782166a00262aa04b10353d2ebc03.tar.gz
opencode-9637d704070782166a00262aa04b10353d2ebc03.zip
fix: UI Freezes for a few minutes if repo has binary files (#4109)
-rw-r--r--packages/opencode/src/snapshot/index.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/packages/opencode/src/snapshot/index.ts b/packages/opencode/src/snapshot/index.ts
index 98b316804..cf051defb 100644
--- a/packages/opencode/src/snapshot/index.ts
+++ b/packages/opencode/src/snapshot/index.ts
@@ -143,15 +143,16 @@ export namespace Snapshot {
export async function diffFull(from: string, to: string): Promise<FileDiff[]> {
const git = gitdir()
const result: FileDiff[] = []
- for await (const line of $`git --git-dir=${git} diff --numstat ${from} ${to} -- .`
+ for await (const line of $`git --git-dir=${git} diff --no-renames --numstat ${from} ${to} -- .`
.quiet()
.cwd(Instance.directory)
.nothrow()
.lines()) {
if (!line) continue
const [additions, deletions, file] = line.split("\t")
- const before = await $`git --git-dir=${git} show ${from}:${file}`.quiet().nothrow().text()
- const after = await $`git --git-dir=${git} show ${to}:${file}`.quiet().nothrow().text()
+ const isBinaryFile = additions === "-" && deletions === "-"
+ const before = isBinaryFile ? "" : await $`git --git-dir=${git} show ${from}:${file}`.quiet().nothrow().text()
+ const after = isBinaryFile ? "" : await $`git --git-dir=${git} show ${to}:${file}`.quiet().nothrow().text()
result.push({
file,
before,