Documentation
¶
Index ¶
- type Branch
- type Commit
- type DeltaStatus
- type Diff
- type DiffDelta
- type DiffFile
- type Error
- type IndexType
- type Ref
- type RefType
- type Repository
- func (r *Repository) AddToIndex(e *StatusEntry) error
- func (r *Repository) Branches() ([]*Branch, error)
- func (r *Repository) Commit(message string, author ...*Signature) (*Commit, error)
- func (r *Repository) Commits() ([]*Commit, error)
- func (r *Repository) CommitsChan(size int) (chan *Commit, error)
- func (r *Repository) LoadHead() error
- func (r *Repository) LoadStatus() (*Status, error)
- func (r *Repository) Path() string
- func (r *Repository) RemoveFromIndex(e *StatusEntry) error
- func (r *Repository) Tags() ([]*Tag, error)
- type Signature
- type State
- type Status
- type StatusEntry
- type StatusEntryType
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Branch ¶
type Branch struct { Name string FullName string Hash string Head bool Ahead int Behind int Upstream *Branch // contains filtered or unexported fields }
Branch is a wrapper of lib.Branch object
type Commit ¶
type Commit struct { Author *Signature Message string Summary string Hash string // contains filtered or unexported fields }
Commit is the wrapper of actual lib.Commit object
type DeltaStatus ¶ added in v0.2.3
type DeltaStatus int
DeltaStatus ondicates a files status in a diff
const ( DeltaUnmodified DeltaStatus = iota DeltaAdded DeltaDeleted DeltaModified DeltaRenamed DeltaCopied DeltaIgnored DeltaUntracked DeltaTypeChange DeltaUnreadable DeltaConflicted )
Delta status of a file e.g. on a commit
type Diff ¶
type Diff struct {
// contains filtered or unexported fields
}
Diff is the wrapper for a diff content acquired from repo
type DiffDelta ¶
type DiffDelta struct { Status DeltaStatus OldFile *DiffFile NewFile *DiffFile Patch string Commit *Commit }
DiffDelta holds delta status, file changes and the actual patchs
func (*DiffDelta) DeltaStatusString ¶ added in v0.2.3
DeltaStatusString retruns delta status as string
type Error ¶ added in v0.2.5
type Error string
Error is the errors from the git package
var ( // ErrAuthenticationRequired as the name implies ErrAuthenticationRequired Error = "authentication required" // ErrAuthenticationType means that given credentials cannot be used for given repository url ErrAuthenticationType Error = "authentication method is not valid" // ErrClone is a generic clone error ErrClone Error = "cannot clone repo" // ErrCannotOpenRepo is returned when the repo couldn't be loaded from filesystem ErrCannotOpenRepo Error = "cannot load repository" // ErrCreateCallbackFail is returned when an error occurred while creating callbacks ErrCreateCallbackFail Error = "cannot create default callbacks" // ErrNoRemoteName if the remote name is empty while fetching ErrNoRemoteName Error = "remote name not specified" // ErrNotValidRemoteName is returned if the given remote name is not found ErrNotValidRemoteName Error = "not a valid remote name" // ErrAlreadyUpToDate if the repo is up-to-date ErrAlreadyUpToDate Error = "already up-to-date" // ErrFastForwardOnly if the merge can be made by fast-forward ErrFastForwardOnly Error = "fast-forward only" // ErrBranchNotFound is returned when the given ref can't found ErrBranchNotFound Error = "cannot locate remote-tracking branch" // ErrEntryNotIndexed is returned when the entry is not indexed ErrEntryNotIndexed Error = "entry is not indexed" )
type IndexType ¶
type IndexType int
IndexType describes the different stages a status entry can be in
type Repository ¶
type Repository struct { RefMap map[string][]Ref Head *Branch // contains filtered or unexported fields }
Repository is the wrapper and main interface to git repository
func Open ¶
func Open(path string) (*Repository, error)
Open load the repository from the filesystem
func (*Repository) AddToIndex ¶ added in v0.2.3
func (r *Repository) AddToIndex(e *StatusEntry) error
AddToIndex is the wrapper of "git add /path/to/file" command
func (*Repository) Branches ¶
func (r *Repository) Branches() ([]*Branch, error)
Branches loads branches with the lib's branch iterator loads both remote and local branches
func (*Repository) Commit ¶ added in v0.2.3
func (r *Repository) Commit(message string, author ...*Signature) (*Commit, error)
Commit adds a new commit onject to repository warning: this function does not check if the changes are indexed
func (*Repository) Commits ¶
func (r *Repository) Commits() ([]*Commit, error)
Commits returns all of the commits of the repository
func (*Repository) CommitsChan ¶ added in v0.3.0
func (r *Repository) CommitsChan(size int) (chan *Commit, error)
Commits returns commits as channel with given size
func (*Repository) LoadHead ¶ added in v0.2.3
func (r *Repository) LoadHead() error
LoadHead can be used to refresh HEAD ref
func (*Repository) LoadStatus ¶ added in v0.2.3
func (r *Repository) LoadStatus() (*Status, error)
LoadStatus simply emulates a "git status" and returns the result
func (*Repository) Path ¶ added in v0.2.3
func (r *Repository) Path() string
Path returns the filesystem location of the repository
func (*Repository) RemoveFromIndex ¶ added in v0.2.3
func (r *Repository) RemoveFromIndex(e *StatusEntry) error
RemoveFromIndex is the wrapper of "git reset path/to/file" command
type Status ¶
type Status struct { State State Entities []*StatusEntry }
Status contains all git status data
type StatusEntry ¶
type StatusEntry struct { EntryType StatusEntryType // contains filtered or unexported fields }
StatusEntry contains data for a single status entry
func (*StatusEntry) Indexed ¶
func (e *StatusEntry) Indexed() bool
Indexed true if entry added to index
func (*StatusEntry) StatusEntryString ¶
func (e *StatusEntry) StatusEntryString() string
StatusEntryString returns entry status in pretty format
func (*StatusEntry) String ¶
func (e *StatusEntry) String() string
Indexed true if entry added to index
type StatusEntryType ¶
type StatusEntryType int
StatusEntryType describes the type of change a status entry has undergone
const ( StatusEntryTypeNew StatusEntryType = iota StatusEntryTypeModified StatusEntryTypeDeleted StatusEntryTypeRenamed StatusEntryTypeUntracked StatusEntryTypeTypeChange StatusEntryTypeConflicted )
The set of supported StatusEntryTypes