Files
GitLite/src/lib/types.ts
T
Christoph Brandau 5752243e6e Implement interactive hunk staging and discarding
Introduce a new dialog that allows users to view file changes as individual hunks and selectively stage, unstage, or discard them. This provides more granular control over modifications, similar to `git add -p`.

Enhance branch panel usability by allowing double-click to checkout a branch.
2026-07-01 14:47:36 +02:00

135 lines
2.7 KiB
TypeScript

export type FileStatusKind =
| "modified"
| "added"
| "deleted"
| "renamed"
| "untracked"
| "conflicted"
| "unknown";
export interface GitStatus {
repo_path: string;
current_branch: string | null;
upstream: string | null;
ahead: number;
behind: number;
files: GitFileStatus[];
clean: boolean;
}
export interface GitFileStatus {
path: string;
old_path: string | null;
staged: FileStatusKind | null;
unstaged: FileStatusKind | null;
}
export type PatchApplyAction = "stage" | "unstage" | "discard-unstaged" | "discard-staged";
export interface GitBranch {
name: string;
current: boolean;
remote: boolean;
}
export interface GitCommit {
hash: string;
short_hash: string;
summary: string;
author_name: string;
author_email: string;
date: string;
refs: string[];
parents: string[];
files: GitCommitFile[];
}
export interface GitCommitFile {
path: string;
old_path: string | null;
status: FileStatusKind;
}
export interface GitRepositoryFile {
path: string;
tracked: boolean;
status: FileStatusKind | null;
}
export interface RepositoryBundle {
status: GitStatus;
branches: GitBranch[];
commits: GitCommit[];
files: GitRepositoryFile[];
}
export interface GitDiffFile {
path: string;
old_path: string | null;
status: FileStatusKind;
additions: number;
deletions: number;
}
export interface GitCommitComparison {
from_hash: string;
from_short: string;
to_hash: string;
to_short: string;
files: GitDiffFile[];
patch: string;
}
export interface GitSearchHit {
commit_hash: string;
short_hash: string;
summary: string;
author_name: string;
author_email: string;
date: string;
file: string;
old_file: string | null;
line_number: number | null;
line: string;
matches_added: number;
}
export type ExplorerNodeKind = "folder" | "file";
export interface ExplorerNode {
name: string;
path: string;
kind: ExplorerNodeKind;
status: FileStatusKind | null;
tracked: boolean;
depth: number;
children: ExplorerNode[];
}
export type ConflictChoice = "ours" | "theirs" | "both-ot" | "both-to";
export type ConflictPart =
| { kind: "text"; lines: string[] }
| { kind: "conflict"; index: number; oursLines: string[]; theirsLines: string[] };
export type PreparedResolution =
| { kind: "content"; content: string }
| { kind: "side"; side: "ours" | "theirs" };
export interface ConflictFile {
path: string;
content: string;
ours: string | null;
theirs: string | null;
base: string | null;
binary: boolean;
ours_size: number | null;
theirs_size: number | null;
}
export interface StoredCredential {
username: string;
password: string;
expiresAt?: string | null;
}