git

package
v1.11.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyResult

type ApplyResult struct {
	OK      bool   `json:"ok"`
	Message string `json:"message,omitempty"`
}

type CommitMessageResult

type CommitMessageResult struct {
	Suggestion string   `json:"suggestion"`
	Files      []string `json:"files"`
	Stats      string   `json:"stats"`
}

type Config

type Config struct {
	RepoDir string
}

type DiffResult

type DiffResult struct {
	Diff string `json:"diff"`
}

type Service

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

func New

func New(cfg Config) (*Service, error)

func (*Service) ApplyPatch

func (s *Service) ApplyPatch(ctx context.Context, patch string) (ApplyResult, error)

ApplyPatch applies a unified diff patch to the repository via `git apply`. Errors from git apply (e.g. conflicts) are returned as ApplyResult{OK:false} rather than a Go error so callers can inspect the message.

func (*Service) CommitMessage

func (s *Service) CommitMessage(ctx context.Context) (CommitMessageResult, error)

CommitMessage inspects the staged diff and returns a conventional-commit suggestion together with the affected file list and diff stats.

func (*Service) Diff

func (s *Service) Diff(ctx context.Context, path string, staged bool) (DiffResult, error)

Diff returns the unified diff for the working tree (or staged changes when staged is true). An optional path restricts the diff to that file.

func (*Service) Status

func (s *Service) Status(ctx context.Context) ([]StatusEntry, error)

Status returns the short-format status of the working tree.

type StatusEntry

type StatusEntry struct {
	Status string `json:"status"`
	Path   string `json:"path"`
}

Jump to

Keyboard shortcuts

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