Documentation ¶
Index ¶
- Variables
- func GitRepoRoot(dir string) (string, error)
- func GitRepoRootFS(dir string, statFS fs.StatFS) (string, error)
- func IsGitRepo(dir string) (bool, error)
- func IsGitRepoFS(dir string, statFS fs.StatFS) (bool, error)
- func NewIgnorer(currentDir, repoRoot string) (ignorer.Ignorer, error)
- type Remote
- type Stats
Constants ¶
This section is empty.
Variables ¶
var ( // ErrGitFatal is returned by Git for fatal application errors, such as // if Git cannot find the .git directory. ErrGitFatal = errors.New("git error") // ErrGitUsage is returned by Git for errors in command line usage.. ErrGitUsage = errors.New("git invalid usage") )
var ( // ErrNotAGitDir is returned when the directory given to the function is // not within a Git repository. ErrNotAGitDir = errors.New("not a Git directory") )
Functions ¶
func GitRepoRoot ¶
GitRepoRoot looks recursively upwards for the Git repository root directory using the file system from the OS.
func GitRepoRootFS ¶
GitRepoRootFS looks recursively upwards for the Git repository root directory using a fs.StatFS.
func IsGitRepo ¶
IsGitRepo checks recursively upwards if a directory is inside a Git repository using the file system from the OS.
func IsGitRepoFS ¶
IsGitRepoFS checks recursively upwards if a directory is inside a Git repository using a fs.StatFS.
Types ¶
type Stats ¶
type Stats struct { CurrentBranch string CurrentBranchSafe string LatestTag string Tags []string CommitHash string CommitShortHash string CommitSubject string CommitComitterDate string CommitAuthorDate string Revision int Remotes map[string]Remote EstimatedRepoGroup string EstimatedRepoName string }
Stats contains info about a Git repository.
func StatsFromExec ¶
StatsFromExec obtains Git repo stats by executing different Git commands.
func (Stats) ListVars ¶
ListVars will return a slice of all variables that this varsub Source provides.
func (Stats) Lookup ¶
Lookup tries to get a value based on the correlated built-in variable name. This method implements the varsub.Source interface.
The string name -> field mapping is based on the documentation: https://iver-wharf.github.io/#/usage-wharfyml/variables/built-in-variables