Documentation ¶
Index ¶
- Variables
- func AddUpstreamRemote(upstreamURL, cloneDir string) error
- func CheckoutBranch(branch string) error
- func CommitBody(sha string) (string, error)
- func Config(name string) (string, error)
- func CurrentBranch() (string, error)
- func DeleteLocalBranch(branch string) error
- func GetDefaultBranch(remote string) (string, error)
- func GetRemoteURL(remoteAlias string) (string, error)
- func HasLocalBranch(branch string) bool
- func IsValidURL(u string) bool
- func ParseURL(rawURL string) (u *url.URL, err error)
- func Push(remote string, ref string, cmdOut, cmdErr io.Writer) error
- func RunClone(cloneURL string, args []string) (target string, err error)
- func RunCmd(args []string) (err error)
- func SetConfig(remote, key, value string) error
- func SetUpstream(remote string, branch string, cmdOut, cmdErr io.Writer) error
- func UncommittedChangeCount() (int, error)
- type BranchConfig
- type Commit
- type Ref
- type Remote
- type RemoteSet
- type SSHAliasMap
- type TrackingRef
Constants ¶
This section is empty.
Variables ¶
var ErrNotOnAnyBranch = errors.New("git: not on any branch")
ErrNotOnAnyBranch indicates that the users is in detached HEAD state
var SetRemoteResolution = func(name, resolution string) error { return SetConfig(name, "glab-resolved", resolution) }
var ToplevelDir = func() (string, error) { showCmd := exec.Command("git", "rev-parse", "--show-toplevel") output, err := run.PrepareCmd(showCmd).Output() return firstLine(output), err }
ToplevelDir returns the top-level directory path of the current repository
Functions ¶
func AddUpstreamRemote ¶
func CheckoutBranch ¶
func CommitBody ¶
func CurrentBranch ¶
CurrentBranch reads the checked-out branch for the git repository
func DeleteLocalBranch ¶
func GetDefaultBranch ¶
GetDefaultBranch finds and returns the remote's default branch
func GetRemoteURL ¶
func HasLocalBranch ¶
func IsValidURL ¶
IsValidUrl tests a string to determine if it is a valid Git url or not.
func SetUpstream ¶
SetUpstream sets the upstream (tracking) of a branch
func UncommittedChangeCount ¶
Types ¶
type BranchConfig ¶
func ReadBranchConfig ¶
func ReadBranchConfig(branch string) (cfg BranchConfig)
ReadBranchConfig parses the `branch.BRANCH.(remote|merge)` part of git config
type Commit ¶
func LatestCommit ¶
type Remote ¶
Remote is a parsed git remote
type SSHAliasMap ¶
SSHAliasMap encapsulates the translation of SSH hostname aliases
func ParseSSHConfig ¶
func ParseSSHConfig() SSHAliasMap
ParseSSHConfig constructs a map of SSH hostname aliases based on user and system configuration files
func (SSHAliasMap) Translator ¶
func (m SSHAliasMap) Translator() func(*url.URL) *url.URL
Translator returns a function that applies hostname aliases to URLs
type TrackingRef ¶
TrackingRef represents a ref for a remote tracking branch
func (TrackingRef) String ¶
func (r TrackingRef) String() string