Documentation ¶
Index ¶
- Variables
- func AddNamedRemote(url, name, repoDir string, branches []string) error
- func CheckoutBranch(branch string) error
- func CheckoutNewBranch(remoteName, 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 GetDirFromPath(repoDir string) (string, error)
- func GitCommand(args ...string) (*gitCommand, error)
- func HasLocalBranch(branch string) bool
- func IsURL(u string) bool
- func ParseURL(rawURL string) (u *url.URL, err error)
- func PathFromRepoRoot() string
- func Pull(remote, branch string) error
- func Push(remote string, ref string, cmdIn io.ReadCloser, cmdOut, cmdErr io.Writer) error
- func RunClone(cloneURL string, args []string) (target string, err error)
- func SetRemoteResolution(name, resolution string) error
- func ToplevelDir() (string, error)
- func UncommittedChangeCount() (int, error)
- func UpdateRemoteURL(name, url string) error
- type BranchConfig
- type Client
- func (c *Client) AddRemote(ctx context.Context, name, urlStr string, trackingBranches []string, ...) (*Remote, error)
- func (c *Client) AuthenticatedCommand(ctx context.Context, args ...string) (*gitCommand, error)
- func (c *Client) CheckoutBranch(ctx context.Context, branch string) error
- func (c *Client) CheckoutNewBranch(ctx context.Context, remoteName, branch string) error
- func (c *Client) Clone(ctx context.Context, cloneURL string, args []string, mods ...CommandModifier) (string, error)
- func (c *Client) Command(ctx context.Context, args ...string) (*gitCommand, error)
- func (c *Client) CommitBody(ctx context.Context, sha string) (string, error)
- func (c *Client) Commits(ctx context.Context, baseRef, headRef string) ([]*Commit, error)
- func (c *Client) Config(ctx context.Context, name string) (string, error)
- func (c *Client) CurrentBranch(ctx context.Context) (string, error)
- func (c *Client) DeleteLocalBranch(ctx context.Context, branch string) error
- func (c *Client) Fetch(ctx context.Context, remote string, refspec string, mods ...CommandModifier) error
- func (c *Client) GitDir(ctx context.Context) (string, error)
- func (c *Client) HasLocalBranch(ctx context.Context, branch string) bool
- func (c *Client) LastCommit(ctx context.Context) (*Commit, error)
- func (c *Client) PathFromRoot(ctx context.Context) string
- func (c *Client) Pull(ctx context.Context, remote, branch string, mods ...CommandModifier) error
- func (c *Client) Push(ctx context.Context, remote string, ref string, mods ...CommandModifier) error
- func (c *Client) ReadBranchConfig(ctx context.Context, branch string) (cfg BranchConfig)
- func (c *Client) Remotes(ctx context.Context) (RemoteSet, error)
- func (c *Client) SetRemoteResolution(ctx context.Context, name, resolution string) error
- func (c *Client) ShowRefs(ctx context.Context, refs []string) ([]Ref, error)
- func (c *Client) ToplevelDir(ctx context.Context) (string, error)
- func (c *Client) UncommittedChangeCount(ctx context.Context) (int, error)
- func (c *Client) UpdateRemoteURL(ctx context.Context, name, url string) error
- type CommandModifier
- type Commit
- type GitError
- type NotInstalled
- type Ref
- type Remote
- type RemoteSet
- type TrackingRef
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotOnAnyBranch = errors.New("git: not on any branch")
ErrNotOnAnyBranch indicates that the user is in detached HEAD state.
Functions ¶
func AddNamedRemote ¶
func CheckoutBranch ¶
func CheckoutNewBranch ¶
func CommitBody ¶
func CurrentBranch ¶
func DeleteLocalBranch ¶
func GetDirFromPath ¶
func GitCommand ¶
func HasLocalBranch ¶
func PathFromRepoRoot ¶
func PathFromRepoRoot() string
func SetRemoteResolution ¶
func ToplevelDir ¶
func UncommittedChangeCount ¶
func UpdateRemoteURL ¶
Types ¶
type BranchConfig ¶
func ReadBranchConfig ¶
func ReadBranchConfig(branch string) (cfg BranchConfig)
type Client ¶
type Client struct { GhPath string RepoDir string GitPath string Stderr io.Writer Stdin io.Reader Stdout io.Writer // contains filtered or unexported fields }
func (*Client) AuthenticatedCommand ¶
AuthenticatedCommand is a wrapper around Command that included configuration to use gh as the credential helper for git.
func (*Client) CheckoutBranch ¶
func (*Client) CheckoutNewBranch ¶
func (*Client) CommitBody ¶
func (*Client) CurrentBranch ¶
CurrentBranch reads the checked-out branch for the git repository.
func (*Client) DeleteLocalBranch ¶
func (*Client) HasLocalBranch ¶
func (*Client) PathFromRoot ¶
Show current directory relative to the top-level directory of repository.
func (*Client) ReadBranchConfig ¶
func (c *Client) ReadBranchConfig(ctx context.Context, branch string) (cfg BranchConfig)
ReadBranchConfig parses the `branch.BRANCH.(remote|merge)` part of git config.
func (*Client) SetRemoteResolution ¶
func (*Client) ToplevelDir ¶
ToplevelDir returns the top-level directory path of the current repository.
func (*Client) UncommittedChangeCount ¶
type CommandModifier ¶
type CommandModifier func(*gitCommand)
Allow individual commands to be modified from the default client options.
func WithRepoDir ¶
func WithRepoDir(repoDir string) CommandModifier
func WithStderr ¶
func WithStderr(stderr io.Writer) CommandModifier
func WithStdin ¶
func WithStdin(stdin io.Reader) CommandModifier
func WithStdout ¶
func WithStdout(stdout io.Writer) CommandModifier
type Commit ¶
func LastCommit ¶
type NotInstalled ¶
type NotInstalled struct {
// contains filtered or unexported fields
}
func (*NotInstalled) Error ¶
func (e *NotInstalled) Error() string
func (*NotInstalled) Unwrap ¶
func (e *NotInstalled) Unwrap() error
type RemoteSet ¶
type RemoteSet []*Remote
RemoteSet is a slice of git remotes.
func RemotesForPath ¶
type TrackingRef ¶
TrackingRef represents a ref for a remote tracking branch.
func (TrackingRef) String ¶
func (r TrackingRef) String() string
Click to show internal directories.
Click to hide internal directories.