add sandlot log command to show branch commits not on main

This commit is contained in:
Chris Wanstrath 2026-02-19 10:12:06 -08:00
parent 586e72610a
commit d4d0010632

View File

@ -331,6 +331,27 @@ program
} }
}) })
// ── sandlot log <branch> ────────────────────────────────────────────
program
.command("log")
.argument("<branch>", "branch name")
.description("Show commits on a branch that are not on main")
.action(async (branch: string) => {
const root = await git.repoRoot()
const session = await state.getSession(root, branch)
if (!session) {
console.error(`No session found for branch "${branch}".`)
process.exit(1)
}
const result = await $`git -C ${session.worktree} log main..HEAD`.nothrow()
if (result.exitCode !== 0) {
console.error("git log failed")
process.exit(1)
}
})
// ── sandlot vm ─────────────────────────────────────────────────────── // ── sandlot vm ───────────────────────────────────────────────────────
const vmCmd = program.command("vm").description("Manage the sandlot VM") const vmCmd = program.command("vm").description("Manage the sandlot VM")