Documentation
¶
Overview ¶
Package gittools provides an interface to querying and invoking the locally installed git executable.
Index ¶
- Variables
- func Git() (string, error)
- func GitDir(path string) (string, error)
- func HasGit() bool
- func InWorkingCopy() (bool, error)
- func IsWorkingCopy(path string) (bool, error)
- func Run(args ...string) ([]byte, error)
- func RunInPath(path string, args ...string) ([]byte, error)
- func Version() (string, error)
- func WorkingCopy(path string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ( MissingGitError = errors.New("git executable not found") MissingWorkingCopyError = errors.New("git working copy not found") )
Functions ¶
func Git ¶
Git returns the absolute path to the locally installed git executable, if found. Otherwise, Git will return an error.
func GitDir ¶
GitDir returns the git directory for the working copy in which path is located, or an error if the path cannot be resolved, or is not located within a working copy. If path is "", the current working directory of the process will be used.
func HasGit ¶
func HasGit() bool
HasGit returns true if the host system has git installed and if the git executable is located within the current user's PATH.
func InWorkingCopy ¶
InWorkingCopy returns true if the current directory is within a git working copy.
func IsWorkingCopy ¶
IsWorkingCopy returns true if path is within a git working copy. If path is "", the current working directory of the process will be used.
func Run ¶
Run attempts to execute the git command in the current process working directory with args arguments. If git is executed successfully, the slice of bytes output to STDOUT by git will be returned, otherwise an error will be returned.
func RunInPath ¶
RunInPath attempts to execute the git command from the path directory (or the parent of path if path represents a file), with args arguments. If git is executed successfully, the slice of bytes output to STDOUT by git will be returned, otherwise an error will be returned. If path is the empty string, the current process working directory will be used.
func Version ¶
Version returns the version string for the installed git executable, or an error if this cannot be determined.
func WorkingCopy ¶
WorkingCopy returns the root of the working copy to which path belongs, if path is within a git working copy. If path is "", the current working directory of the process will be used.
Types ¶
This section is empty.