vcs

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrVCSRepositoryNotExist = errors.New("vcs repository not found")

Functions

This section is empty.

Types

type Logfn

type Logfn func(format string, v ...interface{})

type NoVCsState

type NoVCsState struct{}

NoVCsState implements the StateFetcher interface. All it's methods return VCSRepositoryNotExistErr.

func (*NoVCsState) CommitID

func (*NoVCsState) CommitID() (string, error)

CommitID returns VCSRepositoryNotExistErr.

func (NoVCsState) WithoutUntracked

func (NoVCsState) WithoutUntracked(_ ...string) ([]string, error)

WithoutUntracked returns VCSRepositoryNotExistErr.

func (*NoVCsState) WorktreeIsDirty

func (*NoVCsState) WorktreeIsDirty() (bool, error)

WorktreeIsDirty returns VCSRepositoryNotExistErr.

type StateFetcher

type StateFetcher interface {
	CommitID() (string, error)
	WorktreeIsDirty() (bool, error)
	WithoutUntracked(paths ...string) ([]string, error)
}

StateFetcher is an interface for retrieving information about a VCS repository.

func GetState

func GetState(dir string, logfunc Logfn) (StateFetcher, error)

GetState returns a git.RepositoryState() if the current directory is in a git repository and git command is in $PATH. If it's not, *NoVCsState is returned. The function caches the result for the last directory it was called. logfunc can be nil, to disable logging

Directories

Path Synopsis
Package git provides functionality to interact with a Git repository.
Package git provides functionality to interact with a Git repository.

Jump to

Keyboard shortcuts

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