Documentation ¶
Index ¶
- Constants
- func IsBothWorktreeAndStagingTrackedAndChanged(st extgogit.FileStatus) bool
- func IsEitherWorktreeOrStagingTrackedAndChanged(st extgogit.FileStatus) bool
- func IsTrackedAndChanged(c extgogit.StatusCode) bool
- type CheckoutOpts
- type CloneOpts
- type CommitOpts
- type Git
- func (g *Git) Add(path string) error
- func (g *Git) BasicAuth() *gogithttp.BasicAuth
- func (g *Git) Branch() (string, error)
- func (g *Git) Branches() ([]*plumbing.Reference, error)
- func (g *Git) Checkout(opts ...CheckoutOpts) (*extgogit.Worktree, error)
- func (g *Git) Clone(opts ...CloneOpts) (*extgogit.Repository, error)
- func (g *Git) Commit(msg string, opts ...CommitOpts) (plumbing.Hash, error)
- func (g *Git) Head() (*object.Commit, error)
- func (g *Git) Options() *GitOptions
- func (g *Git) Pull(opts ...PullOpts) error
- func (g *Git) Push(opts ...PushOpts) error
- func (g *Git) Remote(name string) (*GitRemote, error)
- func (g *Git) RemoveBranch(rn plumbing.ReferenceName) error
- func (g *Git) RemoveGoneBranches() error
- func (g *Git) Repo() *extgogit.Repository
- func (g *Git) Reset(opts ...ResetOpts) error
- func (g *Git) SetUpstream(branch string) error
- func (g *Git) Signature() *object.Signature
- type GitOptions
- type GitRemote
- type ListOpts
- type PullOpts
- type PushOpts
- type ResetOpts
Constants ¶
const ( DefaultAuthUser = "anonymous" DefaultTrunkBranch = "main" DefaultRemoteName = "origin" DefaultGitUser = "kuesta" DefaultGitEmail = "kuesta@example.com" )
Variables ¶
This section is empty.
Functions ¶
func IsBothWorktreeAndStagingTrackedAndChanged ¶
func IsBothWorktreeAndStagingTrackedAndChanged(st extgogit.FileStatus) bool
IsBothWorktreeAndStagingTrackedAndChanged returns true if both stating and worktree statuses of the given file are tracked and changed.
func IsEitherWorktreeOrStagingTrackedAndChanged ¶
func IsEitherWorktreeOrStagingTrackedAndChanged(st extgogit.FileStatus) bool
IsEitherWorktreeOrStagingTrackedAndChanged returns true if either stating or worktree status of the given file is tracked and changed.
func IsTrackedAndChanged ¶
func IsTrackedAndChanged(c extgogit.StatusCode) bool
IsTrackedAndChanged returns true if git file status is neither untracked nor unmodified.
Types ¶
type CheckoutOpts ¶
type CheckoutOpts func(o *extgogit.CheckoutOptions)
CheckoutOpts enables modification of the go-git CheckoutOptions.
func CheckoutOptsCreateNew ¶
func CheckoutOptsCreateNew() CheckoutOpts
func CheckoutOptsSoftReset ¶
func CheckoutOptsSoftReset() CheckoutOpts
func CheckoutOptsTo ¶
func CheckoutOptsTo(branch string) CheckoutOpts
type CloneOpts ¶
type CloneOpts func(o *extgogit.CloneOptions)
CloneOpts enables modification of the go-git CheckoutOptions.
type CommitOpts ¶
type CommitOpts func(o *extgogit.CommitOptions)
CommitOpts enables modification of the go-git CommitOptions.
type Git ¶
type Git struct {
// contains filtered or unexported fields
}
func NewGitWithoutRepo ¶
func NewGitWithoutRepo(o *GitOptions) *Git
NewGitWithoutRepo creates Git without setting up a go-git repository.
func (*Git) Add ¶
Add executes `git add` for all created/modified/deleted files included in the given path.
func (*Git) BasicAuth ¶
BasicAuth returns the go-git BasicAuth if git token is provided, otherwise nil.
func (*Git) Checkout ¶
func (g *Git) Checkout(opts ...CheckoutOpts) (*extgogit.Worktree, error)
Checkout switches git branch to the given one and returns git worktree.
func (*Git) Clone ¶
func (g *Git) Clone(opts ...CloneOpts) (*extgogit.Repository, error)
Clone clones remote git repo to the given local path.
func (*Git) Push ¶
Push pushes the specified git branch to remote. If branch is empty, it pushes the branch set by GitOptions.TrunkBranch.
func (*Git) Remote ¶
Remote returns GitRemote of the supplied remote name. If not supplied, it returns the one of GitOptions.RemoteName.
func (*Git) RemoveBranch ¶
func (g *Git) RemoveBranch(rn plumbing.ReferenceName) error
RemoveBranch removes the local branch.
func (*Git) RemoveGoneBranches ¶
RemoveGoneBranches removes all gone branches.
func (*Git) Repo ¶
func (g *Git) Repo() *extgogit.Repository
Repo returns internal go-git repository.
func (*Git) SetUpstream ¶
SetUpstream writes branch remote setting to .git/config.
type GitOptions ¶
type GitOptions struct { RepoUrl string Token string Path string `validate:"required"` TrunkBranch string RemoteName string User string Email string // contains filtered or unexported fields }
func (*GitOptions) ShouldCloneIfNotExist ¶
func (g *GitOptions) ShouldCloneIfNotExist() *GitOptions
func (*GitOptions) Validate ¶
func (g *GitOptions) Validate() error
Validate validates exposed fields according to the `validate` tag.
type GitRemote ¶
type GitRemote struct {
// contains filtered or unexported fields
}
func (*GitRemote) BasicAuth ¶
BasicAuth returns the go-git BasicAuth if git token is provided, otherwise nil.
func (*GitRemote) RemoveBranch ¶
func (r *GitRemote) RemoveBranch(rn plumbing.ReferenceName, opts ...PushOpts) error
RemoveBranch removes the remote branch.
type ListOpts ¶
type ListOpts func(o *extgogit.ListOptions)
ListOpts enables modification of the go-git ListOptions.
type PullOpts ¶
type PullOpts func(o *extgogit.PullOptions)
PullOpts enables modification of the go-git PullOptions.
func PullOptsReference ¶
func PullOptsReference(name plumbing.ReferenceName) PullOpts
type PushOpts ¶
type PushOpts func(o *extgogit.PushOptions)
PushOpts enables modification of the go-git PushOptions.
func PushOptBranch ¶
type ResetOpts ¶
type ResetOpts func(o *extgogit.ResetOptions)
ResetOpts enables modification of the go-git ResetOptions.
func ResetOptsHard ¶
func ResetOptsHard() ResetOpts