git

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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