mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
fix: UI Freezes for a few minutes if repo has binary files (#4109)
This commit is contained in:
parent
cfbbdc2e14
commit
9637d70407
1 changed files with 4 additions and 3 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue