Documentation
¶
Index ¶
- func GetContent(cwd, path, revision string, useTextconv bool) ([]byte, error)
- func GetRepoPrefix(cwd string) (string, error)
- func IsGitRepository(cwd string) bool
- func IsTrackedFile(cwd, path string) bool
- func IsValidRevision(cwd, ref string) bool
- func ListRefs(cwd string, toComplete string) ([]string, error)
- func RunGit(cwd string, args ...string) ([]byte, error)
- type GitFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContent ¶
GetContent reads a file at a given revision (e.g. "HEAD", a hash, or ":" for index). If revision is empty, it reads the local file on disk (applying textconv filter only if useTextconv is true).
func GetRepoPrefix ¶ added in v0.7.0
GetRepoPrefix returns the path prefix of cwd relative to the Git repository worktree root.
func IsGitRepository ¶
IsGitRepository checks if the directory is a Git repository.
func IsTrackedFile ¶ added in v0.7.0
IsTrackedFile checks if a path is tracked in the Git repository index or tree.
func IsValidRevision ¶
IsValidRevision checks if a string is a valid Git revision.
Types ¶
type GitFile ¶
type GitFile struct {
Path string
OldPath string // Non-empty if the file was renamed
Status string // 2-character porcelain status code (e.g. " M", "M ", "??")
Staged bool // True if there are staged changes
Unstaged bool // True if there are unstaged changes or untracked
IsBinary bool // True if the file was identified as binary
}
GitFile represents a modified or untracked file in the repository.
func GetChangedFiles ¶
GetChangedFiles lists files changed between refA and refB. If refA is empty, it returns current working directory status. If refB is empty, it compares refA against the working tree.