git

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package git provides utilities for inspecting Git repository state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RepoStatus

type RepoStatus struct {
	// IsRepo indicates whether the path is inside a git repository.
	IsRepo bool

	// IsDirty indicates whether the working tree has uncommitted changes.
	IsDirty bool

	// Commit is the short SHA of the HEAD commit (empty if not a repo).
	Commit string
}

RepoStatus describes the state of a Git repository at a given path.

func GetRepositoryStatus

func GetRepositoryStatus(ctx context.Context, dir string) (*RepoStatus, error)

GetRepositoryStatus inspects the git repository at dir and returns its status. Returns a non-repo RepoStatus (IsRepo=false) if dir is not inside a git repository. Returns an error only for unexpected failures (not for "not a repo").

Jump to

Keyboard shortcuts

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