git

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotGitRepository is returned when a directory is not inside a git repository
	ErrNotGitRepository = errors.New("not a git repository")
)

Functions

This section is empty.

Types

type Detector

type Detector interface {
	// DetectRepository checks if the given directory is inside a git repository
	// and returns information about the repository if found.
	// Returns ErrNotGitRepository if not inside a git repository.
	DetectRepository(ctx context.Context, dir string) (*RepositoryInfo, error)
}

Detector provides methods for detecting and analyzing git repositories

func NewDetector

func NewDetector() Detector

NewDetector creates a new git repository detector

type Executor

type Executor interface {
	// Output executes a git command in the specified directory and returns its standard output
	Output(ctx context.Context, dir string, args ...string) ([]byte, error)
}

Executor provides an interface for executing git commands

func NewExecutor

func NewExecutor() Executor

NewExecutor creates a new git command executor

type RepositoryInfo

type RepositoryInfo struct {
	// RootDir is the absolute path to the repository root
	RootDir string
	// RemoteURL is the URL of the origin remote (empty if no remote)
	RemoteURL string
	// RelativePath is the relative path from repository root to the queried directory
	RelativePath string
}

RepositoryInfo contains information about a git repository

Jump to

Keyboard shortcuts

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