Add --color=always to git diff commands

This commit is contained in:
Chris Wanstrath 2026-02-19 10:21:57 -08:00
parent b4b5a11a90
commit a640d15a2c

View File

@ -335,15 +335,15 @@ program
if (status.text().trim().length > 0) { if (status.text().trim().length > 0) {
// Show uncommitted changes (both staged and unstaged) // Show uncommitted changes (both staged and unstaged)
const result = await $`git -C ${session.worktree} diff HEAD`.nothrow() const result = await $`git -C ${session.worktree} diff --color=always HEAD`.nothrow()
if (result.exitCode !== 0) { if (result.exitCode !== 0) {
// HEAD may not exist yet (no commits); fall back to showing all tracked + untracked // HEAD may not exist yet (no commits); fall back to showing all tracked + untracked
await $`git -C ${session.worktree} diff`.nothrow() await $`git -C ${session.worktree} diff --color=always`.nothrow()
} }
} else { } else {
// No uncommitted changes — show full branch diff vs main // No uncommitted changes — show full branch diff vs main
const main = await git.mainBranch(root) const main = await git.mainBranch(root)
const result = await $`git -C ${session.worktree} diff ${main}...${branch}`.nothrow() const result = await $`git -C ${session.worktree} diff --color=always ${main}...${branch}`.nothrow()
if (result.exitCode !== 0) { if (result.exitCode !== 0) {
console.error("git diff failed") console.error("git diff failed")
process.exit(1) process.exit(1)