25 lines
709 B
TypeScript
25 lines
709 B
TypeScript
import * as git from "../git.ts"
|
|
import { requireSession } from "./helpers.ts"
|
|
|
|
export async function action(branch: string) {
|
|
const { session } = await requireSession(branch)
|
|
|
|
if (session.prompt) {
|
|
process.stderr.write(`PROMPT: ${session.prompt}\n\n`)
|
|
}
|
|
|
|
const main = await git.mainBranch(session.worktree)
|
|
|
|
// Run git diff with inherited stdio so external diff tools (e.g. difftastic)
|
|
// see a real TTY and git can use its own pager
|
|
const proc = Bun.spawn(["git", "-C", session.worktree, "diff", `${main}...${branch}`], {
|
|
stdin: "inherit",
|
|
stdout: "inherit",
|
|
stderr: "inherit",
|
|
})
|
|
const exitCode = await proc.exited
|
|
if (exitCode !== 0) {
|
|
process.exit(exitCode)
|
|
}
|
|
}
|