Documentation
¶
Index ¶
- Variables
- func IsSupportedProtocol(u *url.URL) bool
- func IsURL(u string) bool
- func ParseURL(rawURL string) (u *url.URL, err error)
- type BranchConfig
- type Command
- type CommandModifier
- type Commit
- type GitCommand
- type GitError
- type NotInstalledError
- 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 IsSupportedProtocol ¶ added in v0.1.0
Types ¶
type BranchConfig ¶
type CommandModifier ¶
type CommandModifier func(*Command)
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 GitCommand ¶ added in v0.1.0
type GitCommand interface {
AddRemote(ctx context.Context, name, urlStr string, trackingBranches []string) (*Remote, error)
AuthenticatedCommand(ctx context.Context, args ...string) (*Command, error)
CheckoutBranch(ctx context.Context, branch string) error
CheckoutNewBranch(ctx context.Context, remoteName, branch string) error
Clone(ctx context.Context, cloneURL string, args []string, mods ...CommandModifier) (string, error)
Command(ctx context.Context, args ...string) (*Command, error)
CommitBody(ctx context.Context, sha string) (string, error)
Commits(ctx context.Context, baseRef, headRef string) ([]*Commit, error)
CurrentBranch(ctx context.Context) (string, error)
DeleteLocalBranch(ctx context.Context, branch string) error
DeleteLocalTag(ctx context.Context, tag string) error
Fetch(ctx context.Context, remote string, refspec string, mods ...CommandModifier) error
GetAuthConfig(ctx context.Context) (authConfig []string, err error)
GetAzDoPath() string
GetConfig(ctx context.Context, name string) (string, error)
GetGitPath() string
GetRepoDir() string
GitDir(ctx context.Context) (string, error)
HasLocalBranch(ctx context.Context, branch string) bool
HasRemoteBranch(ctx context.Context, remote string, branch string) bool
IsLocalGitRepo(ctx context.Context) (bool, error)
LastCommit(ctx context.Context) (*Commit, error)
ParentBranch(ctx context.Context, branch string) (string, error)
PathFromRoot(ctx context.Context) string
Pull(ctx context.Context, remote, branch string, mods ...CommandModifier) error
Push(ctx context.Context, remote string, ref string, mods ...CommandModifier) error
ReadBranchConfig(ctx context.Context, branch string) BranchConfig
Remotes(ctx context.Context) (RemoteSet, error)
// SetAzDoPath(string) error
SetConfig(ctx context.Context, configItems ...string) (err error)
// SetGitPath(string) error
SetRemoteBranches(ctx context.Context, remote string, refspec string) error
SetRemoteResolution(ctx context.Context, name, resolution string) error
SetRepoDir(string) error
ShowRefs(ctx context.Context, refs []string) ([]Ref, error)
ToplevelDir(ctx context.Context) (string, error)
TrackingBranchNames(ctx context.Context, prefix string) []string
UncommittedChangeCount(ctx context.Context) (int, error)
UnsetRemoteResolution(ctx context.Context, name string) error
UpdateRemoteURL(ctx context.Context, name, url string) error
}
func NewGitCommand ¶ added in v0.1.0
func NewGitCommand(io *iostreams.IOStreams) (c GitCommand, err error)
type NotInstalledError ¶ added in v0.0.2
type NotInstalledError struct {
// contains filtered or unexported fields
}
func (*NotInstalledError) Error ¶ added in v0.0.2
func (e *NotInstalledError) Error() string
func (*NotInstalledError) Unwrap ¶ added in v0.0.2
func (e *NotInstalledError) Unwrap() error
type Remote ¶
Remote is a parsed git remote.
func (*Remote) MarshalLogObject ¶ added in v0.6.0
func (r *Remote) MarshalLogObject(enc zapcore.ObjectEncoder) error
type RemoteSet ¶
type RemoteSet []*Remote
RemoteSet is a slice of git remotes.
func (RemoteSet) MarshalLogArray ¶ added in v0.6.0
func (r RemoteSet) MarshalLogArray(enc zapcore.ArrayEncoder) error
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.