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 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) Name ¶ added in v3.2.0
func (*NoVCsState) Name() string
func (*NoVCsState) UntrackedFiles ¶ added in v3.2.0
func (*NoVCsState) UntrackedFiles() ([]string, error)
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)
Name() string
UntrackedFiles() ([]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
Click to show internal directories.
Click to hide internal directories.