Documentation
¶
Overview ¶
Package git provides git repository service.
Index ¶
- type Commit
- type CommitsArgs
- type NextType
- type RepoOptions
- type Repository
- func (r Repository) Add(files ...fsys.File) error
- func (r Repository) AddModified() error
- func (r Repository) CheckDowngrade(v version.V) error
- func (r Repository) CommitTag(v version.V) error
- func (r Repository) Commits(opt ...func(options *CommitsArgs)) ([]Commit, error)
- func (r Repository) Current() (version.V, error)
- func (r Repository) IsClean() (bool, error)
- func (r Repository) NextVersion(nt NextType, custom version.V) (_ version.V, exists bool, _ error)
- func (r Repository) RemoteURL() (string, error)
- func (r Repository) Repo() *git.Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Commit ¶
type Commit struct { // Hash is a commit hash string. Hash string // Message is a commit message. Message string // Author is a commit author. Author string // Version is a commit version (for tag only). Version version.V // Date is a commit date. Date time.Time // Email is an user email. Email string // IsMerge is a merge flag. IsMerge bool }
Commit is a commit wrapper for return to external services.
func (Commit) AuthorHref ¶
AuthorHref returns a commit Author href.
type CommitsArgs ¶
CommitsArgs is a Commits options.
type NextType ¶
type NextType int
NextType is a next version type.
const ( NextNone NextType = iota // NextNone is a next version type none (invalid). NextMajor NextType = iota // NextMajor is a next version type major. NextMinor // NextMinor is a next version type minor. NextPatch // NextPatch is a next version type patch. NextCustom // NextCustom is a next version type custom (need to set custom version). )
NextType values.
type RepoOptions ¶
type RepoOptions struct { Path string Repo *git.Repository }
RepoOptions is a Repository options.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository is a git repository wrapper.
func NewRepository ¶
func NewRepository(opts ...func(options *RepoOptions)) (*Repository, error)
NewRepository returns a new Repository.
func (Repository) Add ¶
func (r Repository) Add(files ...fsys.File) error
Add files to the index. files is list from path to files FROM WORKDIR.
func (Repository) AddModified ¶
func (r Repository) AddModified() error
AddModified adds modified files to the index.
func (Repository) CheckDowngrade ¶
func (r Repository) CheckDowngrade(v version.V) error
CheckDowngrade checks if the version is not downgraded.
func (Repository) CommitTag ¶
func (r Repository) CommitTag(v version.V) error
CommitTag stores a tag and commit changes.
func (Repository) Commits ¶
func (r Repository) Commits(opt ...func(options *CommitsArgs)) ([]Commit, error)
Commits returns commits. If nextV is set, then the tag with this version is not created yet and nextV - new created version. In this case will ber returned commits from last tag to HEAD and last commit will be with nextV. If nextV is not set, then will be returned all commits.
func (Repository) Current ¶
func (r Repository) Current() (version.V, error)
Current returns a current version.
func (Repository) IsClean ¶
func (r Repository) IsClean() (bool, error)
IsClean returns true if all the files are in Unmodified status.
func (Repository) NextVersion ¶
NextVersion returns a next version.
func (Repository) RemoteURL ¶
func (r Repository) RemoteURL() (string, error)
RemoteURL returns a repository name.