Documentation
¶
Overview ¶
Package gitstatus implements the git status plugin with staging/unstaging, diff viewing, commit history, branch management, and conflict resolution.
Index ¶
- func AbortMerge(workDir string) error
- func AbortRebase(workDir string) error
- func BuildCommitURL(info *GitHubInfo, hash string) string
- func CheckoutBranch(workDir, branchName string) error
- func CreateBranch(workDir, branchName string) error
- func DeleteBranch(workDir, branchName string) error
- func DiscardModified(workDir, path string) error
- func DiscardStaged(workDir, path string) error
- func DiscardUntracked(workDir, path string) error
- func ExecuteAmend(workDir, message string) (string, error)
- func ExecuteCommit(workDir, message string) (string, error)
- func ExecuteFetch(workDir string) (string, error)
- func ExecutePull(workDir string) (string, error)
- func ExecutePullAutostash(workDir string) (string, error)
- func ExecutePullFFOnly(workDir string) (string, error)
- func ExecutePullRebase(workDir string) (string, error)
- func ExecutePush(workDir string, force bool) (string, error)
- func ExecutePushForce(workDir string) (string, error)
- func ExecutePushSetUpstream(workDir string) (string, error)
- func ForceDeleteBranch(workDir, branchName string) error
- func GetCommitDiff(workDir, hash, path string, parentHash string) (string, error)
- func GetCommitFullDiff(workDir, hash string) (string, error)
- func GetCommitHistoryFilteredWithPushStatus(workDir string, opts HistoryFilterOpts) ([]*Commit, *PushStatus, error)
- func GetCommitHistoryWithPushStatus(workDir string, limit int) ([]*Commit, *PushStatus, error)
- func GetCommitHistoryWithPushStatusOffset(workDir string, limit, skip int) ([]*Commit, *PushStatus, error)
- func GetConflictedFiles(workDir string) []string
- func GetDiff(workDir, path string, staged bool) (string, error)
- func GetFileDiffStats(workDir, path string, staged bool) (int, int, error)
- func GetFolderDiff(workDir string, files []*FileEntry) (string, error)
- func GetFullDiff(workDir string, staged bool) (string, error)
- func GetNewFileDiff(workDir, path string) (string, error)
- func GetRemoteName(workDir string) string
- func GetRemoteURL(workDir string) string
- func HasRemote(workDir string) bool
- func IsConflictError(err error) bool
- func IsRebaseInProgress(workDir string) bool
- func ParsePushOutput(output string) string
- func PopulatePushStatus(commits []*Commit, pushStatus *PushStatus)
- func RelativeTime(t time.Time) string
- func RenderFileHeader(filename, stats string, width int) string
- func RenderLineDiff(diff *ParsedDiff, width, startLine, maxLines, horizontalOffset int, ...) string
- func RenderMultiFileDiff(mfd *MultiFileDiff, mode DiffViewMode, ...) string
- func RenderSideBySide(diff *ParsedDiff, width, startLine, maxLines, horizontalOffset int, ...) string
- func StashApply(workDir, ref string) error
- func StashDrop(workDir, ref string) error
- func StashPop(workDir string) error
- func StashPopRef(workDir, ref string) error
- func StashPush(workDir string) error
- func StashPushIncludeUntracked(workDir string) error
- func StashPushWithMessage(workDir, message string) error
- type Branch
- type BranchError
- type BranchErrorMsg
- type BranchListLoadedMsg
- type BranchSwitchSuccessMsg
- type Commit
- func GetCommitDetail(workDir, hash string) (*Commit, error)
- func GetCommitHistory(workDir string, limit int) ([]*Commit, error)
- func GetCommitHistoryFiltered(workDir string, opts HistoryFilterOpts) ([]*Commit, error)
- func GetCommitHistoryWithOffset(workDir string, limit, skip int) ([]*Commit, error)
- type CommitError
- type CommitErrorMsg
- type CommitFile
- type CommitPreviewLoadedMsg
- type CommitStats
- type CommitStatsLoadedMsg
- type CommitSuccessMsg
- type DiffLine
- type DiffLoadedMsg
- type DiffStats
- type DiffViewMode
- type ErrorMsg
- type FetchErrorMsg
- type FetchSuccessClearMsg
- type FetchSuccessMsg
- type FileDiffInfo
- type FileEntry
- type FileStatus
- type FileTree
- func (t *FileTree) AllEntries() []*FileEntry
- func (t *FileTree) HasStagedFiles() bool
- func (t *FileTree) Refresh() error
- func (t *FileTree) StageAll() error
- func (t *FileTree) StageFile(path string) error
- func (t *FileTree) StagedStats() (additions, deletions int)
- func (t *FileTree) Summary() string
- func (t *FileTree) TotalCount() int
- func (t *FileTree) UnstageAll() error
- func (t *FileTree) UnstageFile(path string) error
- type FilteredCommitsLoadedMsg
- type FocusPane
- type GitHubInfo
- type GraphColumn
- type GraphLine
- type GraphState
- type HighlightSegment
- type HistoryFilterOpts
- type HistorySearchState
- type Hunk
- type InlineDiffLoadedMsg
- type LineType
- type MoreCommitsLoadedMsg
- type MultiFileDiff
- type ParsedDiff
- type Plugin
- func (p *Plugin) Commands() []plugin.Command
- func (p *Plugin) ConsumesTextInput() bool
- func (p *Plugin) Diagnostics() []plugin.Diagnostic
- func (p *Plugin) FocusContext() string
- func (p *Plugin) ID() string
- func (p *Plugin) Icon() string
- func (p *Plugin) Init(ctx *plugin.Context) error
- func (p *Plugin) IsFocused() bool
- func (p *Plugin) Name() string
- func (p *Plugin) SetFocused(f bool)
- func (p *Plugin) Start() tea.Cmd
- func (p *Plugin) Stop()
- func (p *Plugin) Update(msg tea.Msg) (plugin.Plugin, tea.Cmd)
- func (p *Plugin) View(width, height int) string
- type PullAbortedMsg
- type PullErrorMsg
- type PullSuccessClearMsg
- type PullSuccessMsg
- type PushError
- type PushErrorMsg
- type PushStatus
- type PushStatusLoadedMsg
- type PushSuccessClearMsg
- type PushSuccessMsg
- type RecentCommitsLoadedMsg
- type RefreshDoneMsg
- type RemoteError
- type RepoDetectedMsg
- type RepoInitDoneMsg
- type SideBySideClipInfo
- type Stash
- type StashError
- type StashErrorMsg
- type StashList
- type StashPopConfirmMsg
- type StashResultMsg
- type SyntaxHighlighter
- type ViewMode
- type WatchEventMsg
- type WatchStartedMsg
- type Watcher
- type WordSegment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCommitURL ¶
func BuildCommitURL(info *GitHubInfo, hash string) string
BuildCommitURL constructs a GitHub commit URL.
func CheckoutBranch ¶
CheckoutBranch switches to a branch.
func CreateBranch ¶
CreateBranch creates a new branch from HEAD.
func DeleteBranch ¶
DeleteBranch deletes a branch.
func DiscardModified ¶
DiscardModified discards unstaged changes to a modified file.
func DiscardStaged ¶
DiscardStaged discards staged changes to a file (unstages and restores).
func DiscardUntracked ¶
DiscardUntracked removes an untracked file.
func ExecuteAmend ¶
ExecuteAmend executes a git commit --amend with the given message.
func ExecuteCommit ¶
ExecuteCommit executes a git commit with the given message. Returns the commit hash on success or an error with git output on failure.
func ExecutePullAutostash ¶
ExecutePullAutostash runs git pull --rebase --autostash.
func ExecutePullFFOnly ¶
ExecutePullFFOnly runs git pull --ff-only.
func ExecutePullRebase ¶
ExecutePullRebase runs git pull --rebase.
func ExecutePush ¶
ExecutePush performs a git push operation. Returns the output from git and any error encountered.
func ExecutePushForce ¶
ExecutePushForce performs a force push with lease. Returns the output from git and any error encountered.
func ExecutePushSetUpstream ¶
ExecutePushSetUpstream performs a push with upstream tracking. Returns the output from git and any error encountered.
func ForceDeleteBranch ¶
ForceDeleteBranch force-deletes a branch.
func GetCommitDiff ¶
GetCommitDiff returns the diff for a specific file in a commit. For merge commits, parentHash should be the first parent so we diff against it instead of using git show's combined diff (which is empty for clean merges).
func GetCommitFullDiff ¶
GetCommitFullDiff returns the full diff for a commit.
func GetCommitHistoryFilteredWithPushStatus ¶
func GetCommitHistoryFilteredWithPushStatus(workDir string, opts HistoryFilterOpts) ([]*Commit, *PushStatus, error)
GetCommitHistoryFilteredWithPushStatus fetches filtered commits and populates push status.
func GetCommitHistoryWithPushStatus ¶
func GetCommitHistoryWithPushStatus(workDir string, limit int) ([]*Commit, *PushStatus, error)
GetCommitHistoryWithPushStatus fetches commits and populates push status.
func GetCommitHistoryWithPushStatusOffset ¶
func GetCommitHistoryWithPushStatusOffset(workDir string, limit, skip int) ([]*Commit, *PushStatus, error)
GetCommitHistoryWithPushStatusOffset fetches commits with offset and populates push status.
func GetConflictedFiles ¶
GetConflictedFiles returns a list of files with merge conflicts.
func GetFileDiffStats ¶
GetFileDiffStats returns the +/- counts for a single file.
func GetFolderDiff ¶
GetFolderDiff creates a concatenated diff for all files in an untracked folder. Each file gets a header with its path, followed by its content as additions.
func GetFullDiff ¶
GetFullDiff returns the diff for all changes.
func GetNewFileDiff ¶
GetNewFileDiff creates a diff-like view for an untracked file. Shows file content as all additions (new file).
func GetRemoteName ¶
GetRemoteName returns the primary remote name (usually "origin"). Returns empty string if no remotes are configured.
func GetRemoteURL ¶
GetRemoteURL returns the URL for the primary remote (origin).
func IsConflictError ¶
IsConflictError checks if a RemoteError indicates merge/rebase conflicts.
func IsRebaseInProgress ¶
IsRebaseInProgress checks if a rebase is currently in progress.
func ParsePushOutput ¶
ParsePushOutput extracts useful information from git push output. Returns a human-readable summary.
func PopulatePushStatus ¶
func PopulatePushStatus(commits []*Commit, pushStatus *PushStatus)
PopulatePushStatus updates the Pushed field for a list of commits based on the provided push status.
func RelativeTime ¶
RelativeTime returns a human-readable relative time string.
func RenderFileHeader ¶
RenderFileHeader renders a file header bar for the diff.
func RenderLineDiff ¶
func RenderLineDiff(diff *ParsedDiff, width, startLine, maxLines, horizontalOffset int, highlighter *SyntaxHighlighter, wrapEnabled bool) string
RenderLineDiff renders a parsed diff in unified line-by-line format with line numbers. horizontalOffset scrolls the content horizontally (0 = no scroll). highlighter is optional - if nil, no syntax highlighting is applied. wrapEnabled wraps long lines instead of truncating them.
func RenderMultiFileDiff ¶
func RenderMultiFileDiff(mfd *MultiFileDiff, mode DiffViewMode, width, startLine, maxLines, horizontalOffset int, wrapEnabled bool) string
RenderMultiFileDiff renders a multi-file diff with file headers. Returns the rendered content and updates file position info.
func RenderSideBySide ¶
func RenderSideBySide(diff *ParsedDiff, width, startLine, maxLines, horizontalOffset int, highlighter *SyntaxHighlighter, wrapEnabled bool) string
RenderSideBySide renders a parsed diff in side-by-side format. highlighter is optional - if nil, no syntax highlighting is applied. wrapEnabled wraps long lines instead of truncating them.
func StashApply ¶
StashApply applies a stash without removing it.
func StashPopRef ¶
StashPopRef pops a specific stash by reference.
func StashPushIncludeUntracked ¶
StashPushIncludeUntracked creates a stash including untracked files.
func StashPushWithMessage ¶
StashPushWithMessage creates a new stash with a custom message.
Types ¶
type Branch ¶
type Branch struct {
Name string // Branch name
IsCurrent bool // True if this is the current branch
IsRemote bool // True if this is a remote tracking branch
Upstream string // Upstream branch name (if set)
Ahead int // Commits ahead of upstream
Behind int // Commits behind upstream
LastCommit string // Short hash of last commit
}
Branch represents a git branch.
func GetBranches ¶
GetBranches retrieves the list of local branches.
func (*Branch) FormatTrackingInfo ¶
FormatTrackingInfo formats the ahead/behind info for display.
type BranchError ¶
BranchError wraps a git branch error with its output.
func (*BranchError) Error ¶
func (e *BranchError) Error() string
type BranchErrorMsg ¶
type BranchErrorMsg struct {
Err error
}
BranchErrorMsg is sent when a branch operation fails.
type BranchListLoadedMsg ¶
type BranchListLoadedMsg struct {
Epoch uint64 // Epoch when request was issued (for stale detection)
Branches []*Branch
}
BranchListLoadedMsg is sent when branch list is loaded.
func (BranchListLoadedMsg) GetEpoch ¶
func (m BranchListLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type BranchSwitchSuccessMsg ¶
type BranchSwitchSuccessMsg struct {
Branch string
}
BranchSwitchSuccessMsg is sent when branch switch succeeds.
type Commit ¶
type Commit struct {
Hash string
ShortHash string
Author string
AuthorEmail string
Date time.Time
Subject string
Body string
Files []CommitFile
Stats CommitStats
Pushed bool // Whether this commit has been pushed to upstream
ParentHashes []string // Parent commit hashes (empty for root commits)
IsMerge bool // True if commit has multiple parents
}
Commit represents a git commit.
func GetCommitDetail ¶
GetCommitDetail fetches full commit info including file list.
func GetCommitHistory ¶
GetCommitHistory fetches recent commits.
func GetCommitHistoryFiltered ¶
func GetCommitHistoryFiltered(workDir string, opts HistoryFilterOpts) ([]*Commit, error)
GetCommitHistoryFiltered fetches commits with filters applied.
type CommitError ¶
CommitError wraps a git commit error with its output.
func (*CommitError) Error ¶
func (e *CommitError) Error() string
type CommitErrorMsg ¶
type CommitErrorMsg struct {
Err error
}
type CommitFile ¶
type CommitFile struct {
Path string
OldPath string // For renames
Status FileStatus
Additions int
Deletions int
}
CommitFile represents a file changed in a commit.
type CommitPreviewLoadedMsg ¶
type CommitPreviewLoadedMsg struct {
Epoch uint64 // Epoch when request was issued (for stale detection)
Commit *Commit
}
CommitPreviewLoadedMsg is sent when commit preview is loaded.
func (CommitPreviewLoadedMsg) GetEpoch ¶
func (m CommitPreviewLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type CommitStats ¶
CommitStats holds aggregate commit statistics.
type CommitStatsLoadedMsg ¶
type CommitStatsLoadedMsg struct {
Epoch uint64 // Epoch when request was issued (for stale detection)
Hash string
Stats CommitStats
}
CommitStatsLoadedMsg is sent when commit stats are loaded.
func (CommitStatsLoadedMsg) GetEpoch ¶
func (m CommitStatsLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type CommitSuccessMsg ¶
type DiffLine ¶
type DiffLine struct {
Type LineType
OldLineNo int // 0 means not applicable
NewLineNo int // 0 means not applicable
Content string
WordDiff []WordSegment
}
DiffLine represents a single line in a diff.
type DiffLoadedMsg ¶
type DiffLoadedMsg struct {
Epoch uint64 // Epoch when request was issued (for stale detection)
Content string // Rendered content (may be from delta)
Raw string // Raw diff for built-in rendering
}
func (DiffLoadedMsg) GetEpoch ¶
func (m DiffLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type DiffViewMode ¶
type DiffViewMode int
DiffViewMode specifies the diff rendering mode.
const ( DiffViewUnified DiffViewMode = iota // Line-by-line unified view DiffViewSideBySide // Side-by-side split view )
type FetchErrorMsg ¶
type FetchErrorMsg struct {
Err error
}
FetchErrorMsg is sent when fetch fails.
type FetchSuccessClearMsg ¶
type FetchSuccessClearMsg struct{}
FetchSuccessClearMsg is sent to clear the fetch success indicator.
type FetchSuccessMsg ¶
type FetchSuccessMsg struct {
Output string
}
FetchSuccessMsg is sent when fetch succeeds.
type FileDiffInfo ¶
type FileDiffInfo struct {
Diff *ParsedDiff
StartLine int // Line position where this file starts in rendered output
EndLine int // Line position where this file ends
Additions int // Number of added lines
Deletions int // Number of deleted lines
}
FileDiffInfo holds a parsed diff with rendering position info.
func (*FileDiffInfo) ChangeStats ¶
func (f *FileDiffInfo) ChangeStats() string
ChangeStats returns a formatted string like "+10/-5".
func (*FileDiffInfo) FileName ¶
func (f *FileDiffInfo) FileName() string
FileName returns the display filename (prefers NewFile, falls back to OldFile).
type FileEntry ¶
type FileEntry struct {
Path string
Status FileStatus
Staged bool
Unstaged bool
OldPath string // For renames
DiffStats DiffStats
IsExpanded bool
IsFolder bool // True if this represents an untracked folder
Children []*FileEntry // Files within this folder (when IsFolder is true)
}
FileEntry represents a single file or folder in the git status.
type FileStatus ¶
type FileStatus string
FileStatus represents the git status of a file.
const ( StatusModified FileStatus = "M" StatusAdded FileStatus = "A" StatusDeleted FileStatus = "D" StatusRenamed FileStatus = "R" StatusCopied FileStatus = "C" StatusUntracked FileStatus = "?" StatusIgnored FileStatus = "!" StatusUnmerged FileStatus = "U" )
type FileTree ¶
type FileTree struct {
Staged []*FileEntry
Modified []*FileEntry
Untracked []*FileEntry
// contains filtered or unexported fields
}
FileTree groups files by status category.
func NewFileTree ¶
NewFileTree creates an empty file tree for the given work directory.
func (*FileTree) AllEntries ¶
AllEntries returns all entries in display order. Folder entries are included, and if expanded, their children follow.
func (*FileTree) HasStagedFiles ¶
HasStagedFiles returns true if there are any staged files.
func (*FileTree) StagedStats ¶
StagedStats returns total additions and deletions for staged files.
func (*FileTree) TotalCount ¶
TotalCount returns the total number of changed files.
func (*FileTree) UnstageAll ¶
UnstageAll unstages all staged files.
func (*FileTree) UnstageFile ¶
UnstageFile unstages a file.
type FilteredCommitsLoadedMsg ¶
type FilteredCommitsLoadedMsg struct {
Epoch uint64 // Epoch when request was issued (for stale detection)
Commits []*Commit
PushStatus *PushStatus
}
FilteredCommitsLoadedMsg is sent when filtered commits are fetched.
func (FilteredCommitsLoadedMsg) GetEpoch ¶
func (m FilteredCommitsLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type FocusPane ¶
type FocusPane int
FocusPane represents which pane is active in the three-pane view.
type GitHubInfo ¶
GitHubInfo holds parsed GitHub repository information.
func ParseGitHubInfo ¶
func ParseGitHubInfo(remoteURL string) *GitHubInfo
ParseGitHubInfo extracts owner/repo from a GitHub remote URL. Returns nil if not a GitHub URL.
type GraphColumn ¶
type GraphColumn struct {
CommitHash string // Hash of commit this column is tracking toward
Active bool // Whether this column is currently in use
}
GraphColumn tracks the state of one branch line in the commit graph.
type GraphLine ¶
type GraphLine struct {
Chars []rune // The ASCII characters for this line (*, |, \, /, etc.)
Width int // Total visual width of this line
}
GraphLine holds the ASCII characters for one commit row.
func ComputeGraphForCommits ¶
ComputeGraphForCommits generates GraphLine for each commit in order.
type GraphState ¶
type GraphState struct {
// contains filtered or unexported fields
}
GraphState maintains state while computing graph for commit list.
func NewGraphState ¶
func NewGraphState() *GraphState
NewGraphState creates a new graph computation state.
func (*GraphState) ComputeGraphLine ¶
func (g *GraphState) ComputeGraphLine(commit *Commit) GraphLine
ComputeGraphLine generates the GraphLine for a commit given current state. Updates state for the next commit.
type HighlightSegment ¶
HighlightSegment represents a segment of highlighted text.
type HistoryFilterOpts ¶
type HistoryFilterOpts struct {
Author string // Filter by author (--author)
Path string // Filter by file path (-- <path>)
Limit int
Skip int
}
HistoryFilterOpts holds options for filtered commit queries.
type HistorySearchState ¶
type HistorySearchState struct {
Query string
Matches []*Commit // Commits matching the query
Cursor int // Index in matches for n/N navigation
Committed bool // True after Enter (enables n/N)
// Search options
UseRegex bool
CaseSensitive bool
}
HistorySearchState holds state for commit history search.
func NewHistorySearchState ¶
func NewHistorySearchState() *HistorySearchState
NewHistorySearchState creates a new search state.
func (*HistorySearchState) Reset ¶
func (s *HistorySearchState) Reset()
Reset clears the search state.
type Hunk ¶
type Hunk struct {
OldStart int
OldCount int
NewStart int
NewCount int
Header string
Lines []DiffLine
}
Hunk represents a diff hunk.
type InlineDiffLoadedMsg ¶
type InlineDiffLoadedMsg struct {
Epoch uint64 // Epoch when request was issued (for stale detection)
File string
Raw string
Parsed *ParsedDiff
}
InlineDiffLoadedMsg is sent when an inline diff finishes loading.
func (InlineDiffLoadedMsg) GetEpoch ¶
func (m InlineDiffLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type MoreCommitsLoadedMsg ¶
type MoreCommitsLoadedMsg struct {
Epoch uint64 // Epoch when request was issued (for stale detection)
Commits []*Commit
PushStatus *PushStatus
}
MoreCommitsLoadedMsg is sent when additional commits are fetched for infinite scroll.
func (MoreCommitsLoadedMsg) GetEpoch ¶
func (m MoreCommitsLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type MultiFileDiff ¶
type MultiFileDiff struct {
Files []FileDiffInfo
}
MultiFileDiff holds multiple file diffs with navigation info.
func ParseMultiFileDiff ¶
func ParseMultiFileDiff(diff string) *MultiFileDiff
ParseMultiFileDiff parses a git diff output containing multiple files.
func (*MultiFileDiff) FileAtLine ¶
func (mfd *MultiFileDiff) FileAtLine(line int) int
FileAtLine returns the file index at the given line position, or -1 if none.
func (*MultiFileDiff) FileCount ¶
func (mfd *MultiFileDiff) FileCount() int
FileCount returns the number of files in the diff.
func (*MultiFileDiff) TotalLines ¶
func (mfd *MultiFileDiff) TotalLines() int
TotalLines returns the total number of rendered lines for a multi-file diff.
type ParsedDiff ¶
ParsedDiff represents a fully parsed diff.
func ParseUnifiedDiff ¶
func ParseUnifiedDiff(diff string) (*ParsedDiff, error)
ParseUnifiedDiff parses a unified diff format string.
func (*ParsedDiff) MaxLineNumber ¶
func (p *ParsedDiff) MaxLineNumber() int
MaxLineNumber returns the maximum line number in the diff.
func (*ParsedDiff) TotalLines ¶
func (p *ParsedDiff) TotalLines() int
TotalLines returns the total number of content lines in the diff.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the git status plugin.
func (*Plugin) ConsumesTextInput ¶
ConsumesTextInput reports whether the plugin is currently in a mode where printable keys should be treated as text input.
func (*Plugin) Diagnostics ¶
func (p *Plugin) Diagnostics() []plugin.Diagnostic
Diagnostics returns plugin health info.
func (*Plugin) FocusContext ¶
FocusContext returns the current focus context.
type PullAbortedMsg ¶
type PullAbortedMsg struct{}
PullAbortedMsg is sent when a conflicted pull is aborted.
type PullErrorMsg ¶
PullErrorMsg is sent when pull fails.
type PullSuccessClearMsg ¶
type PullSuccessClearMsg struct{}
PullSuccessClearMsg is sent to clear the pull success indicator.
type PullSuccessMsg ¶
type PullSuccessMsg struct {
Output string
}
PullSuccessMsg is sent when pull succeeds.
type PushStatus ¶
type PushStatus struct {
HasUpstream bool // Whether an upstream branch is configured
UpstreamBranch string // Name of upstream branch (e.g., "origin/main")
Ahead int // Commits ahead of upstream
Behind int // Commits behind upstream
UnpushedHashes []string // Hashes of unpushed commits
DetachedHead bool // Whether HEAD is detached
CurrentBranch string // Current branch name (empty if detached)
}
PushStatus represents the push state of the current branch.
func GetPushStatus ¶
func GetPushStatus(workDir string) *PushStatus
GetPushStatus retrieves the push status for the current branch. Returns a PushStatus struct with information about ahead/behind counts, unpushed commits, and upstream configuration. Always returns a valid PushStatus (may be minimal if operations fail).
func (*PushStatus) CanPush ¶
func (ps *PushStatus) CanPush() bool
CanPush checks if there are commits that can be pushed.
func (*PushStatus) FormatAheadBehind ¶
func (ps *PushStatus) FormatAheadBehind() string
FormatAheadBehind returns a formatted string showing ahead/behind status. Examples: "↑2", "↓1", "↑2 ↓1", "" (when synced)
func (*PushStatus) IsCommitPushed ¶
func (ps *PushStatus) IsCommitPushed(hash string) bool
IsCommitPushed checks if a commit hash is pushed to the upstream. Returns true if the commit is in the upstream branch. Hash can be either full (40 chars) or short (7+ chars).
func (*PushStatus) NeedsForce ¶
func (ps *PushStatus) NeedsForce() bool
NeedsForce checks if push would require force (when behind upstream).
type PushStatusLoadedMsg ¶
type PushStatusLoadedMsg struct {
Status *PushStatus
}
PushStatusLoadedMsg is sent when push status is loaded.
type PushSuccessClearMsg ¶
type PushSuccessClearMsg struct{}
PushSuccessClearMsg is sent to clear the push success indicator.
type PushSuccessMsg ¶
type PushSuccessMsg struct {
Output string
}
PushSuccessMsg is sent when a push completes successfully.
type RecentCommitsLoadedMsg ¶
type RecentCommitsLoadedMsg struct {
Epoch uint64 // Epoch when request was issued (for stale detection)
Commits []*Commit
PushStatus *PushStatus
}
RecentCommitsLoadedMsg is sent when recent commits are loaded for sidebar.
func (RecentCommitsLoadedMsg) GetEpoch ¶
func (m RecentCommitsLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type RemoteError ¶
RemoteError wraps a git remote operation error with its output.
func (*RemoteError) Error ¶
func (e *RemoteError) Error() string
type RepoDetectedMsg ¶
RepoDetectedMsg is sent after probing for a repository in the current workdir.
func (RepoDetectedMsg) GetEpoch ¶
func (m RepoDetectedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type RepoInitDoneMsg ¶
RepoInitDoneMsg is sent after attempting to run git init. Root is set on successful repository creation. Err is optional and may contain non-fatal warnings (for example, .gitignore update failures).
func (RepoInitDoneMsg) GetEpoch ¶
func (m RepoInitDoneMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type SideBySideClipInfo ¶
type SideBySideClipInfo struct {
HasMoreLeft bool // True if scrolled right (horizOffset > 0)
HasMoreRight bool // True if content extends beyond visible width
MaxContentWidth int // Maximum width of any line in the diff
}
SideBySideClipInfo contains information about horizontal clipping state.
func GetSideBySideClipInfo ¶
func GetSideBySideClipInfo(diff *ParsedDiff, contentWidth, horizontalOffset int) SideBySideClipInfo
GetSideBySideClipInfo calculates clipping info for a side-by-side diff. contentWidth is the width available for each side's content (after line numbers).
type Stash ¶
type Stash struct {
Index int // stash index (0 = most recent)
Ref string // stash@{0}, stash@{1}, etc.
Branch string // Branch the stash was created on
Message string // Stash message
}
Stash represents a single stash entry.
type StashError ¶
StashError wraps a git stash error with its output.
func (*StashError) Error ¶
func (e *StashError) Error() string
type StashErrorMsg ¶
type StashErrorMsg struct {
Err error
}
StashErrorMsg is sent when stash operations fail.
type StashList ¶
type StashList struct {
Stashes []*Stash
}
StashList represents the list of stashes.
func GetStashList ¶
GetStashList retrieves the list of stashes.
type StashPopConfirmMsg ¶
type StashPopConfirmMsg struct {
Stash *Stash
}
StashPopConfirmMsg is sent when the stash pop confirm modal should be shown.
type StashResultMsg ¶
type StashResultMsg struct {
Operation string // "push", "pop", or "apply"
Ref string // stash ref for display (e.g. "stash@{0}")
Err error
}
StashResultMsg is sent when a stash operation completes.
type SyntaxHighlighter ¶
type SyntaxHighlighter struct {
// contains filtered or unexported fields
}
SyntaxHighlighter provides syntax highlighting for diff content using Chroma.
func NewSyntaxHighlighter ¶
func NewSyntaxHighlighter(filename string) *SyntaxHighlighter
NewSyntaxHighlighter creates a highlighter for the given filename. Returns nil if no lexer is available for the file type.
func (*SyntaxHighlighter) Highlight ¶
func (h *SyntaxHighlighter) Highlight(line string) []HighlightSegment
Highlight tokenizes and highlights a line of code. Returns segments with lipgloss styles applied.
func (*SyntaxHighlighter) HighlightLine ¶
func (h *SyntaxHighlighter) HighlightLine(content string) []HighlightSegment
HighlightLine highlights a single line of code, returning styled segments.
type ViewMode ¶
type ViewMode int
ViewMode represents the current view state.
const ( ViewModeStatus ViewMode = iota // Current file list (three-pane layout) ViewModeDiff // Full-screen diff view ViewModeCommit // Commit message editor ViewModePushMenu // Push options popup menu ViewModePullMenu // Pull options popup menu ViewModeConfirmDiscard // Confirm discard changes modal ViewModeBranchPicker // Branch selection modal ViewModeConfirmStashPop // Confirm stash pop modal ViewModePullConflict // Pull conflict resolution modal ViewModeError // Generic error modal for git operation failures )
type WatchEventMsg ¶
type WatchEventMsg struct{}
type WatchStartedMsg ¶
type WatchStartedMsg struct{ Watcher *Watcher }
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher monitors the .git directory for changes.
func NewWatcher ¶
NewWatcher creates a new git directory watcher.
type WordSegment ¶
WordSegment represents a segment of text with word-level diff highlighting.
Source Files
¶
- branch.go
- branch_picker.go
- clipboard.go
- commit_view.go
- confirm_discard.go
- confirm_stash_pop.go
- data_loaders.go
- diff.go
- diff_parser.go
- diff_renderer.go
- doc.go
- error_modal.go
- git_operations.go
- gitcmd.go
- github.go
- graph.go
- history.go
- history_search.go
- mouse.go
- no_repo.go
- plugin.go
- preview_selection.go
- pull_menu.go
- push.go
- push_menu.go
- remote.go
- scroll_layout.go
- sidebar_view.go
- stash.go
- syntax_highlight.go
- tree.go
- trunc_cache.go
- update_handlers.go
- view.go
- watcher.go