// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
 * Lightweight info the SCM panel renders next to its commit
 * input: the active branch name, a short HEAD hash for the
 * detached state, and ahead/behind counts vs the upstream.
 * `None` (for the strings) and `0` (for the counts) are the
 * "this signal isn't available right now" fallbacks; the panel
 * renders the empty case as an inert label rather than a hard
 * error.
 */
export type GitBranchInfo = { 
/**
 * Branch name, e.g. `"main"`. `None` when HEAD is detached,
 * the folder isn't a git repo, or `git` itself isn't on PATH —
 * the SCM panel falls back to `head_short_sha` for the
 * detached case and to a plain "no branch" label otherwise.
 */
name: string | null, 
/**
 * First seven characters of the HEAD commit's SHA. `None` when
 * the repo has no commits yet (a fresh `git init`), HEAD is
 * unreadable, or the folder isn't a git repo.
 */
headShortSha: string | null, 
/**
 * Whether the current branch has a configured upstream
 * (`branch.<name>.remote` + `branch.<name>.merge`). `false`
 * when the branch was just created locally and never pushed,
 * when HEAD is detached, and when the folder isn't a git
 * repo. Distinguishes "has an upstream" (the SCM panel
 * renders Sync Changes) from "no upstream yet" (Publish
 * branch). Note that `branch.<name>.remote` can be either a
 * named remote (`"origin"`) or a git URL (`gh pr checkout`
 * on a fork PR points it at the fork URL); both count as
 * having an upstream, see `upstream_tracked` for the
 * distinction the UI cares about.
 */
hasUpstream: boolean, 
/**
 * Whether the configured upstream is a tracked named remote
 * — i.e. `@{u}` resolves to a `refs/remotes/...` ref. `true`
 * for the normal `git clone` / `git push -u origin` shape;
 * `false` for the `gh pr checkout` fork-PR shape where
 * `branch.<name>.remote` is a bare URL and no remote-tracking
 * ref exists. The SCM panel uses this to decide whether the
 * `ahead` / `behind` counts are meaningful — when `false`,
 * they're always `0` (we can't compute counts without a
 * remote-tracking ref) and the panel shows Sync Changes
 * without count badges so the user can still push commits
 * back to the fork. Always `false` when `has_upstream ==
 * false`.
 */
upstreamTracked: boolean, 
/**
 * Whether the configured upstream is a *foreign* tracked
 * branch — a named-remote branch (`upstream_tracked ==
 * true`) whose short name differs from the local branch.
 * This is the `git checkout -b feature origin/main` shape:
 * the new branch tracks `refs/heads/main` for pull / rebase
 * purposes but has no remote branch of its own yet. Pushing
 * to its configured upstream would fast-forward the *shared*
 * branch (land the feature commits straight on `main`), so
 * the SCM panel treats it exactly like an unpublished branch
 * — it offers "Publish branch" (`git push -u origin HEAD`,
 * which creates `origin/<branch>` and re-points tracking)
 * rather than Sync Changes, and `git_push` refuses to update
 * the foreign branch. `false` for the normal same-name
 * upstream, the fork-PR URL shape, and whenever
 * `upstream_tracked == false`.
 */
upstreamForeign: boolean, 
/**
 * Number of commits the local branch has that its configured
 * upstream doesn't — commits that would be sent on the next
 * `git push`. `0` when there's no upstream configured, no
 * HEAD, the upstream isn't tracked (`upstream_tracked ==
 * false`), or the count couldn't be determined.
 */
ahead: number, 
/**
 * Number of commits the upstream has that the local branch
 * doesn't — commits that would be merged in on the next
 * `git pull`. Same `0`-fallback semantics as `ahead`.
 */
behind: number, 
/**
 * Pre-built URL for opening a pull request against the
 * repo's primary remote. `Some` only when the remote is a
 * recognised host (currently `github.com`), HEAD is on a
 * named branch (not detached), and the branch name has
 * successfully URL-escaped. The SCM panel still gates the
 * "Open PR" button on UI policy (non-main / non-master,
 * `has_upstream`); the backend just produces the URL when
 * it has the inputs.
 */
prUrl: string | null, 
/**
 * Remote-tracking ref for the repo's default branch — e.g.
 * `"origin/main"`. Resolved from `refs/remotes/origin/HEAD`
 * when present, else falls back to `origin/main` →
 * `origin/master`. `None` when no `origin` remote exists,
 * the symbolic ref isn't set, and neither fallback is
 * available; the SCM panel hides its "Update from <main>"
 * affordance in that case.
 */
defaultBranchRemoteRef: string | null, 
/**
 * Number of commits the default branch's remote-tracking
 * ref has that the current branch's HEAD doesn't — what a
 * `git merge <default_branch_remote_ref>` would land. `0`
 * when no default can be resolved, when HEAD is already up
 * to date, when we're already on the default branch (the
 * regular `Sync Changes` button covers that case), or when
 * the count couldn't be determined. The SCM panel shows the
 * "Update from main" button iff this is `> 0`.
 */
defaultBranchBehind: number, 
/**
 * Local short name of the branch `git switch -` would return
 * to — the previous checked-out branch, resolved via
 * `git rev-parse --abbrev-ref @{-1}`. `None` when there's no
 * previous switch recorded (fresh repo, `@{-1}` doesn't
 * resolve), or when the previous state was detached HEAD (git
 * only records branch names, so `@{-1}` abbreviates to empty).
 * Lets the SCM panel render a "switch back to <branch>" button
 * while sitting on the default branch, without keeping its own
 * history.
 */
previousBranch: string | null, };
