From 917bef4015182b85badfa2b74e6e4fc88b4df2cd Mon Sep 17 00:00:00 2001 From: Adam Bowker Date: Wed, 1 Apr 2026 11:07:48 -0700 Subject: [PATCH] fix(git): compare against HEAD instead of working directory in diff --- packages/git/src/queries.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/git/src/queries.ts b/packages/git/src/queries.ts index 1705488dc..c66ae82e1 100644 --- a/packages/git/src/queries.ts +++ b/packages/git/src/queries.ts @@ -499,8 +499,9 @@ export async function getChangedFilesDetailed( continue; } try { - const unstaged = await git.diff([file]); - const lines = unstaged.split("\n"); + const headDiff = await git.diff(["HEAD", "--", file]); + if (!headDiff.trim()) continue; + const lines = headDiff.split("\n"); const linesAdded = lines.filter( (l) => l.startsWith("+") && !l.startsWith("+++"), ).length; @@ -525,6 +526,10 @@ export async function getChangedFilesDetailed( ) { continue; } + try { + const headDiff = await git.diff(["HEAD", "--", file]); + if (!headDiff.trim()) continue; + } catch {} files.push({ path: file, status: "deleted",