Documentation ¶
Overview ¶
Package gitdirty provides utility functions for inspecting the state of a local git repository.
Currently, gitdirty executes the `git` command, so git must be installed for it to work.
Index ¶
- func GitInstalled() bool
- func PathIsDirty(log hclog.Logger, repoPath string, remoteUrl string, remoteBranch string, ...) (bool, error)
- func RepoIsDirty(log hclog.Logger, repoPath string, remoteUrl string, remoteBranch string) (bool, error)
- func RepoTopLevelPath(log hclog.Logger, pathWithinVcs string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GitInstalled ¶
func GitInstalled() bool
GitInstalled checks if the command-line tool `git` is installed
func PathIsDirty ¶
func PathIsDirty(log hclog.Logger, repoPath string, remoteUrl string, remoteBranch string, path string) (bool, error)
PathIsDirty checks only the specified file for unstaged, staged, and committed (but not pushed) changes on the local GitDirty.path repo not on the specified remote url and branch. If path is empty, this will check the entire repo. CAVEAT: This does not fetch any remotes, and therefore will not detect if the local copy is behind the remote,
func RepoIsDirty ¶
func RepoIsDirty(log hclog.Logger, repoPath string, remoteUrl string, remoteBranch string) (bool, error)
RepoIsDirty looks for unstaged, staged, and committed (but not pushed) changes on the local GitDirty.path repo not on the specified remote url and branch. CAVEAT: This does not fetch any remotes, and therefore will not detect if the local copy is behind the remote,
func RepoTopLevelPath ¶
RepoTopLevelPath returns the path to the root of the repository that contains pathWithinVcs. Equivalent to git rev-parse --show-toplevel
Types ¶
This section is empty.