git

package
v0.11.507 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoGitRepoFound = errors.New("no git repository found")
)

Functions

func ChangedFilesFromBase added in v0.11.505

func ChangedFilesFromBase(repoPath, baseBranch string) ([]string, error)

ChangedFilesFromBase returns the list of file paths (relative to the repo root) that have changed between the merge base of the given base branch and HEAD.

func CurrentCommit added in v0.11.152

func CurrentCommit(path string) (string, error)

func DefaultBranch added in v0.11.505

func DefaultBranch(repoPath string) (string, error)

DefaultBranch returns the default branch name for the repository at the given path. It tries to detect it from the remote HEAD, falling back to checking if "main" or "master" exist.

func EnsureGivenPatternIsInGitignore

func EnsureGivenPatternIsInGitignore(fs afero.Fs, repoRoot string, pattern string) (err error)

Types

type Repo

type Repo struct {
	Path string `json:"path"`
}

Repo represents the path of a given git repository.

func FindRepoFromPath

func FindRepoFromPath(path string) (*Repo, error)

func FindRepoInSubtree added in v0.11.195

func FindRepoInSubtree(root string) (*Repo, error)

FindRepoInSubtree finds the git repository in the subtree specified by path. In contrast to FindRepoFromPath, this functions decends down into a directory, and returns the first repository it finds.

type RepoFinder

type RepoFinder struct{}

RepoFinder is a wrapper for finding the root path of a git repository.

func (*RepoFinder) Repo

func (*RepoFinder) Repo(path string) (*Repo, error)

Repo uses git by spawning a process to locate the top level directory.

Jump to

Keyboard shortcuts

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