spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / hooks / pane-state / has-session-files.ts
22 lines · 668 BRaw
1import type Git from '../git'
2
3/**
4 * Whether a fetch settled with a file the header would count, so a pane
5 * opened on it lists something where emptyStateOf would find a headline.
6 *
7 * No repository, a diff git could not read, and rows that all predate the
8 * session count nothing.
9 *
10 * @param outcome how the fetch ended
11 * @returns whether the header's session file count is above zero
12 */
13export function hasSessionFiles(outcome: Git.FetchOutcome): boolean {
14 if (outcome.kind !== 'data') {
15 return false
16 }
17
18 const { stats, files } = outcome.data
19 const before = files.filter(file => file.isPreSession)
20
21 return stats.filesCount - before.length > 0
22}