Documentation ¶
Index ¶
- type Change
- type ChangeCode
- type Changes
- type GitRepository
- func (r *GitRepository) AddGlob(glob string) error
- func (r *GitRepository) GetCurrentBranch() (string, error)
- func (r *GitRepository) GetFilesInIndex() ([]string, error)
- func (r *GitRepository) GetIndexChanges() (map[string]Changes, error)
- func (r *GitRepository) GetLastTag() (string, error)
- func (r *GitRepository) GetUser() (User, error)
- func (r *GitRepository) RemoveGlob(glob string) error
- type GoGitRepository
- type RepositoryOption
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct { Status ChangeCode Change string }
type ChangeCode ¶
type ChangeCode byte
const ( Unmodified ChangeCode = '=' Added ChangeCode = '+' Deleted ChangeCode = '-' )
type GitRepository ¶
type GitRepository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(options ...RepositoryOption) *GitRepository
NewRepository returns not initialized git repo with passed options.
Repo has lazy initialization. Error in case of error opening the repository will be returned only on the first access to any method.
func (*GitRepository) AddGlob ¶
func (r *GitRepository) AddGlob(glob string) error
func (*GitRepository) GetCurrentBranch ¶
func (r *GitRepository) GetCurrentBranch() (string, error)
GetCurrentBranch return current branch name.
func (*GitRepository) GetFilesInIndex ¶
func (r *GitRepository) GetFilesInIndex() ([]string, error)
func (*GitRepository) GetIndexChanges ¶
func (r *GitRepository) GetIndexChanges() (map[string]Changes, error)
nolint: cyclop
func (*GitRepository) GetLastTag ¶
func (r *GitRepository) GetLastTag() (string, error)
nolint: cyclop
func (*GitRepository) GetUser ¶
func (r *GitRepository) GetUser() (User, error)
func (*GitRepository) RemoveGlob ¶
func (r *GitRepository) RemoveGlob(glob string) error
type GoGitRepository ¶
type GoGitRepository interface { BlobObject(h plumbing.Hash) (*object.Blob, error) BlobObjects() (*object.BlobIter, error) Branch(name string) (*config.Branch, error) Branches() (storer.ReferenceIter, error) CommitObject(h plumbing.Hash) (*object.Commit, error) CommitObjects() (object.CommitIter, error) Config() (*config.Config, error) ConfigScoped(scope config.Scope) (*config.Config, error) CreateBranch(c *config.Branch) error CreateRemote(c *config.RemoteConfig) (*git.Remote, error) CreateRemoteAnonymous(c *config.RemoteConfig) (*git.Remote, error) CreateTag(name string, hash plumbing.Hash, opts *git.CreateTagOptions) (*plumbing.Reference, error) DeleteBranch(name string) error DeleteObject(hash plumbing.Hash) error DeleteRemote(name string) error DeleteTag(name string) error Fetch(o *git.FetchOptions) error FetchContext(ctx context.Context, o *git.FetchOptions) error Head() (*plumbing.Reference, error) Log(o *git.LogOptions) (object.CommitIter, error) Notes() (storer.ReferenceIter, error) Object(t plumbing.ObjectType, h plumbing.Hash) (object.Object, error) Objects() (*object.ObjectIter, error) Prune(opt git.PruneOptions) error Push(o *git.PushOptions) error PushContext(ctx context.Context, o *git.PushOptions) error Reference(name plumbing.ReferenceName, resolved bool) (*plumbing.Reference, error) References() (storer.ReferenceIter, error) Remote(name string) (*git.Remote, error) Remotes() ([]*git.Remote, error) RepackObjects(cfg *git.RepackConfig) (err error) ResolveRevision(rev plumbing.Revision) (*plumbing.Hash, error) SetConfig(cfg *config.Config) error Tag(name string) (*plumbing.Reference, error) TagObject(h plumbing.Hash) (*object.Tag, error) TagObjects() (*object.TagIter, error) Tags() (storer.ReferenceIter, error) TreeObject(h plumbing.Hash) (*object.Tree, error) TreeObjects() (*object.TreeIter, error) Worktree() (*git.Worktree, error) }
nolint: interfacebloat
type RepositoryOption ¶
type RepositoryOption = func(repo *GitRepository)
func WithFactoryMethod ¶
func WithFactoryMethod(factory factoryMethod) RepositoryOption
func WithFsRepo ¶
func WithFsRepo(path string) RepositoryOption
func WithGitRepository ¶
func WithGitRepository(gitRepo *git.Repository) RepositoryOption
Click to show internal directories.
Click to hide internal directories.