status

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

internal/status/git.go

internal/status/numstat.go

internal/status/porcelain.go

internal/status/reader.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitReader

type GitReader struct {
	// contains filtered or unexported fields
}

func NewGitReader

func NewGitReader() *GitReader

func (*GitReader) Fetch

func (r *GitReader) Fetch(ctx context.Context, repoPath string) (*model.RepoStatus, error)

Fetch runs git fetch and returns updated status. Returns the fetch error (if any) alongside the current status so callers can distinguish "fetch failed but here's the old status" from "status read failed".

func (*GitReader) FetchBatch

func (r *GitReader) FetchBatch(ctx context.Context, paths []string) (map[string]*model.RepoStatus, map[string]error)

func (*GitReader) GetDiffStats

func (r *GitReader) GetDiffStats(ctx context.Context, repoPath string) *model.DiffStats

GetDiffStats reads line-level diff stats, commit activity, and file churn for a repo. All 4 git commands run in parallel with independent timeouts. Always returns a result (possibly with partial data) — never returns an error since all sub-commands are non-fatal.

func (*GitReader) GetDiffStatsBatch

func (r *GitReader) GetDiffStatsBatch(ctx context.Context, paths []string) map[string]*model.DiffStats

func (*GitReader) GetStatus

func (r *GitReader) GetStatus(ctx context.Context, repoPath string) (*model.RepoStatus, error)

func (*GitReader) GetStatusBatch

func (r *GitReader) GetStatusBatch(ctx context.Context, paths []string) (map[string]*model.RepoStatus, map[string]error)

func (*GitReader) GetStatusFromOutput

func (r *GitReader) GetStatusFromOutput(ctx context.Context, repoPath string, porcelainOutput string) (*model.RepoStatus, error)

GetStatusFromOutput builds a full RepoStatus from pre-fetched porcelain output, running supplementary commands (stash, log, remote) in parallel.

func (*GitReader) RunAlias

func (r *GitReader) RunAlias(ctx context.Context, repoPath string, cmd string) (string, error)

type Reader

type Reader interface {
	GetStatus(ctx context.Context, repoPath string) (*model.RepoStatus, error)
	GetStatusFromOutput(ctx context.Context, repoPath string, porcelainOutput string) (*model.RepoStatus, error)
	GetStatusBatch(ctx context.Context, paths []string) (map[string]*model.RepoStatus, map[string]error)

	// Fetch returns the fetch error alongside the status so callers can
	// distinguish "fetch failed but here's the old status" from "status read failed".
	Fetch(ctx context.Context, repoPath string) (*model.RepoStatus, error)
	FetchBatch(ctx context.Context, paths []string) (map[string]*model.RepoStatus, map[string]error)

	// GetDiffStats always returns a result (possibly partial) — never nil.
	GetDiffStats(ctx context.Context, repoPath string) *model.DiffStats
	GetDiffStatsBatch(ctx context.Context, paths []string) map[string]*model.DiffStats

	RunAlias(ctx context.Context, repoPath string, cmd string) (string, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL