Documentation ¶
Overview ¶
Package git contains various commands that shell out to git
Package git contains various commands that shell out to git
Index ¶
- Constants
- Variables
- func DefaultRemote() (string, error)
- func FormatGitDate(tm time.Time) string
- func GitAndRootDirs() (string, string, error)
- func GitDir() (string, error)
- func IsVersionAtLeast(actualVersion, desiredVersion string) bool
- func LsRemote(remote, remoteRef string) (string, error)
- func ParseGitDate(str string) (time.Time, error)
- func RemoteBranchForLocalBranch(localBranch string) string
- func RemoteForBranch(localBranch string) string
- func RemoteForCurrentBranch() (string, error)
- func RemoteList() ([]string, error)
- func RemoteRefNameForCurrentBranch() (string, error)
- func RootDir() (string, error)
- func UpdateIndex(file string) error
- func ValidateRemote(remote string) error
- type CommitSummary
- type Ref
- type RefType
Constants ¶
Variables ¶
var Config = &gitConfig{}
Functions ¶
func DefaultRemote ¶ added in v1.0.1
DefaultRemote returns the default remote based on: 1. The currently tracked remote branch, if present 2. "origin", if defined 3. Any other SINGLE remote defined in .git/config Returns an error if all of these fail, i.e. no tracked remote branch, no "origin", and either no remotes defined or 2+ non-"origin" remotes
func FormatGitDate ¶ added in v0.6.0
FormatGitDate converts a Go date into a git command line format date
func GitAndRootDirs ¶ added in v1.1.1
func IsVersionAtLeast ¶ added in v1.1.0
IsVersionAtLeast compares 2 version strings (ok to be prefixed with 'git version', ignores)
func ParseGitDate ¶ added in v0.6.0
Parse a Git date formatted in ISO 8601 format (%ci/%ai)
func RemoteBranchForLocalBranch ¶ added in v1.0.1
RemoteBranchForLocalBranch returns the name (only) of the remote branch that the local branch is tracking If no specific branch is configured, returns local branch name
func RemoteForBranch ¶ added in v1.0.1
RemoteForBranch returns the remote name that a given local branch is tracking (blank if none)
func RemoteForCurrentBranch ¶ added in v1.0.1
RemoteForCurrentBranch returns the name of the remote that the current branch is tracking
func RemoteList ¶ added in v1.0.1
func RemoteRefNameForCurrentBranch ¶ added in v1.0.1
RemoteRefForCurrentBranch returns the full remote ref (remote/remotebranch) that the current branch is tracking
func UpdateIndex ¶ added in v0.5.2
func ValidateRemote ¶ added in v1.0.1
ValidateRemote checks that a named remote is valid for use Mainly to check user-supplied remotes & fail more nicely
Types ¶
type CommitSummary ¶ added in v0.6.0
type CommitSummary struct { Sha string ShortSha string Parents []string CommitDate time.Time AuthorDate time.Time AuthorName string AuthorEmail string CommitterName string CommitterEmail string Subject string }
Some top level information about a commit (only first line of message)
func GetCommitSummary ¶ added in v0.6.0
func GetCommitSummary(commit string) (*CommitSummary, error)
Get summary information about a commit
type Ref ¶ added in v0.6.0
A git reference (branch, tag etc)
func CurrentRef ¶
func CurrentRemoteRef ¶
func GetAllWorkTreeHEADs ¶ added in v1.1.0
GetAllWorkTreeHEADs returns the refs that all worktrees are using as HEADs This returns all worktrees plus the master working copy, and works even if working dir is actually in a worktree right now Pass in the git storage dir (parent of 'objects') to work from
func RecentBranches ¶ added in v0.6.0
RecentBranches returns branches with commit dates on or after the given date/time Return full Ref type for easier detection of duplicate SHAs etc since: refs with commits on or after this date will be included includeRemoteBranches: true to include refs on remote branches onlyRemote: set to non-blank to only include remote branches on a single remote