gitdirty

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

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

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

func RepoTopLevelPath(log hclog.Logger, pathWithinVcs string) (string, error)

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.

Jump to

Keyboard shortcuts

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