git

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect(dir string) bool

Detect detects whether this directory is inside a Git repository

func GetCurrentBranch

func GetCurrentBranch(dir string) (string, error)

func GetCurrentCommit

func GetCurrentCommit(dir string) (string, error)

func GetGitRoot

func GetGitRoot(dir string) string

If the given directory is in a Git repository, GetGitRoot checks whether the given folder is in a Git repository, then returns the absolute path to the root folder of that Git repository, or the dir given as argument when it is not a Git repo.

func GetRemoteURL

func GetRemoteURL(dir string) (string, error)

GetRemoteURL returns the URL of the `origin` Git remote.

func IsDirty

func IsDirty(dir string) bool

IsDirty returns true when there are changed files in the repository.

func IsTracking

func IsTracking(dir string, pattern string) bool

IsTracking checks whether the Git repository in the given folder is tracking the files specified by the given pattern. This can be a literal folder or file name, but can also be a pattern containing wildcards, e.g. 'foo.*'

func MakeGitInfo

func MakeGitInfo(dir string) api.GitInfo

MakeGitInfo creates a description of the Git repository in the given directory. Returns an empty api.GitInfo{} when the dir is not a Git repo.

Types

type FileSize

type FileSize struct {
	Path       string
	CommitHash string
	Size       uint64
}

FileSize is the return type for FindLargeFiles. Contains the path to the file and its filesize, and, if specified, the commit hash on which the given file was created.

func FindLargeFiles

func FindLargeFiles(dir string, threshold uint64) ([]FileSize, error)

FindLargeFiles looks for any files being tracked in the current Git repository that have a filesize larger than the given threshold, measured in bytes.

func FindLargeFilesInHistory

func FindLargeFilesInHistory(dir string, threshold uint64) ([]FileSize, error)

Jump to

Keyboard shortcuts

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