Documentation
¶
Index ¶
- Constants
- Variables
- func AddStackRefDir(dir string) (string, error)
- func AddStackRefFile(title string, stackRef StackRef) error
- func AddUpstreamRemote(upstreamURL, cloneDir string) error
- func CheckoutBranch(branch string) error
- func CheckoutNewBranch(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 DeleteStackRefFile(title string, stackRef StackRef) error
- func DescribeByTags() (string, error)
- func GetAllConfig(key string) ([]byte, error)
- func GetCurrentStackTitle() (title string, err error)
- func GetDefaultBranch(remote string) (string, error)
- func GetRemoteURL(remoteAlias string) (string, error)
- func GitUserName() ([]byte, error)
- func HasLocalBranch(branch string) bool
- func InitGitRepo(t *testing.T) string
- func InitGitRepoWithCommit(t *testing.T) string
- func IsValidURL(u string) bool
- func ListTags() ([]string, error)
- 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(key, value string) error
- func SetLocalConfig(key, value string) error
- func SetRemoteConfig(remote, key, value string) error
- func SetUpstream(remote string, branch string, cmdOut, cmdErr io.Writer) error
- func StackRootDir(title string) (string, error)
- func UncommittedChangeCount() (int, error)
- func UpdateStackRefFile(title string, s StackRef) error
- type BranchConfig
- type Commit
- type GitRunner
- type Ref
- type Remote
- type RemoteSet
- type SSHAliasMap
- type Stack
- type StackRef
- type StandardGitCommand
- type TrackingRef
Constants ¶
const DefaultRemote = "origin"
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 SetRemoteConfig(name, "glab-resolved", resolution) }
var StackLocation = filepath.Join(".git", "stacked")
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 AddStackRefDir ¶ added in v1.42.0
func AddStackRefFile ¶ added in v1.42.0
func AddUpstreamRemote ¶
func CheckoutBranch ¶
func CheckoutNewBranch ¶ added in v1.42.0
func CommitBody ¶
func CurrentBranch ¶
CurrentBranch reads the checked-out branch for the git repository
func DeleteLocalBranch ¶
func DeleteStackRefFile ¶ added in v1.42.0
func DescribeByTags ¶ added in v1.30.0
DescribeByTags gives a description of the current object. Non-annotated tags are considered. Reference: https://git-scm.com/docs/git-describe
func GetAllConfig ¶ added in v1.32.0
GetConfig returns the local config value associated with the provided key. If there are multiple values associated with the key, they are all returned.
func GetCurrentStackTitle ¶ added in v1.42.0
func GetDefaultBranch ¶
GetDefaultBranch finds and returns the remote's default branch
func GetRemoteURL ¶
func GitUserName ¶ added in v1.42.0
func HasLocalBranch ¶
func InitGitRepo ¶ added in v1.41.0
func InitGitRepoWithCommit ¶ added in v1.41.0
func IsValidURL ¶
IsValidUrl tests a string to determine if it is a valid Git url or not.
func SetLocalConfig ¶ added in v1.42.0
func SetRemoteConfig ¶ added in v1.32.0
func SetUpstream ¶
SetUpstream sets the upstream (tracking) of a branch
func StackRootDir ¶ added in v1.42.0
func UncommittedChangeCount ¶
func UpdateStackRefFile ¶ added in v1.42.0
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 Stack ¶ added in v1.42.0
func GatherStackRefs ¶ added in v1.42.0
func (*Stack) RemoveBranch ¶ added in v1.42.0
type StackRef ¶ added in v1.42.0
type StackRef struct { Prev string `json:"prev"` Branch string `json:"branch"` SHA string `json:"sha"` Next string `json:"next"` MR string `json:"mr"` Description string `json:"description"` }
func CurrentStackRefFromBranch ¶ added in v1.42.0
type StandardGitCommand ¶ added in v1.42.0
type StandardGitCommand struct{}
type TrackingRef ¶
TrackingRef represents a ref for a remote tracking branch
func (TrackingRef) String ¶
func (r TrackingRef) String() string