Update files

This commit is contained in:
Mohamed Boudra
2026-02-04 09:44:27 +07:00
parent 9daec94333
commit 2fd818c156

View File

@@ -547,8 +547,14 @@ export async function getCheckoutDiff(
throw new Error(`Base ref mismatch: expected ${baseRef}, got ${compare.baseRef}`);
} else {
const normalizedBaseRef = normalizeLocalBranchRefName(baseRef);
// Diff base ref against working tree (includes uncommitted changes)
const { stdout: trackedDiff } = await execAsync(`git diff ${normalizedBaseRef}`, {
// Find the merge-base (common ancestor) to diff only changes on this branch
const { stdout: mergeBaseOut } = await execAsync(
`git merge-base ${normalizedBaseRef} HEAD`,
{ cwd, env: READ_ONLY_GIT_ENV }
);
const mergeBase = mergeBaseOut.trim();
// Diff from merge-base to working tree (includes uncommitted changes)
const { stdout: trackedDiff } = await execAsync(`git diff ${mergeBase}`, {
cwd,
env: READ_ONLY_GIT_ENV,
});