Documentation ¶
Overview ¶
Package GoGits - Git is a pure Go implementation of Git manipulation.
Index ¶
- Variables
- func IntToStr(n int) string
- func IsBranchExist(repoPath, branchName string) bool
- func IsSha1(sha1 string) bool
- func IsTagExist(repoPath, tagName string) bool
- func NewId(b []byte) (sha1, error)
- func NewIdFromString(s string) (sha1, error)
- func RefEndName(refStr string) string
- func StrToInt(str string) (int, error)
- func UnpackRefs(repoPath string) error
- type Blob
- type Commit
- func (c *Commit) CommitsBefore() (*list.List, error)
- func (c *Commit) CommitsBeforeUntil(commitId string) (*list.List, error)
- func (c *Commit) CommitsByRange(page int) (*list.List, error)
- func (c *Commit) CommitsCount() (int, error)
- func (c *Commit) CreateArchive(zipPath string) error
- func (c *Commit) GetCommitOfRelPath(relPath string) (*Commit, error)
- func (c *Commit) Message() string
- func (c *Commit) Parent(n int) (*Commit, error)
- func (c *Commit) ParentCount() int
- func (c *Commit) ParentId(n int) (id sha1, err error)
- func (c *Commit) SearchCommits(keyword string) (*list.List, error)
- func (c *Commit) Summary() string
- func (c *Commit) TreeId() sha1
- type Entries
- type EntryMode
- type Object
- type ObjectType
- type Repository
- func (repo *Repository) CommitsBefore(commitId string) (*list.List, error)
- func (repo *Repository) CommitsBetween(last *Commit, before *Commit) (*list.List, error)
- func (repo *Repository) CommitsByRange(commitId string, page int) (*list.List, error)
- func (repo *Repository) CommitsCount(commitId string) (int, error)
- func (repo *Repository) GetBranches() ([]string, error)
- func (repo *Repository) GetCommit(commitId string) (*Commit, error)
- func (repo *Repository) GetCommitIdOfBranch(branchName string) (string, error)
- func (repo *Repository) GetCommitIdOfTag(tagName string) (string, error)
- func (repo *Repository) GetCommitOfBranch(branchName string) (*Commit, error)
- func (repo *Repository) GetCommitOfRelPath(commitId, relPath string) (*Commit, error)
- func (repo *Repository) GetCommitOfTag(tagName string) (*Commit, error)
- func (repo *Repository) GetTags() ([]string, error)
- func (repo *Repository) GetTree(idStr string) (*Tree, error)
- func (repo *Repository) IsBranchExist(branchName string) bool
- func (repo *Repository) IsTagExist(tagName string) bool
- func (repo *Repository) SearchCommits(commitId, keyword string) (*list.List, error)
- func (repo *Repository) Type(id sha1) (ObjectType, error)
- type Signature
- type Tree
- type TreeEntry
- func (te *TreeEntry) Blob() *Blob
- func (te *TreeEntry) EntryMode() EntryMode
- func (te *TreeEntry) IsDir() bool
- func (te *TreeEntry) ModTime() time.Time
- func (te *TreeEntry) Mode() (mode os.FileMode)
- func (te *TreeEntry) Name() string
- func (te *TreeEntry) Size() int64
- func (te *TreeEntry) Sys() interface{}
- type TreeWalkCallback
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotExist = errors.New("error not exist")
)
var (
IdNotExist = errors.New("sha1 id not exist")
)
Functions ¶
func IsBranchExist ¶
func IsTagExist ¶
func NewIdFromString ¶
Create a new sha1 from a Sha1 string of length 40.
func RefEndName ¶
func UnpackRefs ¶
UnpackRefs unpacks 'packed-refs' to git repository.
Types ¶
type Commit ¶
type Commit struct { Tree Id sha1 // The id of this commit object Author *Signature Committer *Signature CommitMessage string // contains filtered or unexported fields }
Commit represents a git commit.
func (*Commit) CommitsBeforeUntil ¶
func (*Commit) CommitsCount ¶
func (*Commit) CreateArchive ¶
func (*Commit) GetCommitOfRelPath ¶
func (*Commit) ParentCount ¶
Return the number of parents of the commit. 0 if this is the root commit, otherwise 1,2,...
type Object ¶
type Object struct { Type ObjectType Id sha1 }
type ObjectType ¶
type ObjectType int
Who am I?
const ( ObjectCommit ObjectType = 0x10 ObjectTree ObjectType = 0x20 ObjectBlob ObjectType = 0x30 ObjectTag ObjectType = 0x40 )
func (ObjectType) String ¶
func (t ObjectType) String() string
type Repository ¶
type Repository struct { Path string // contains filtered or unexported fields }
A Repository is the base of all other actions. If you need to lookup a commit, tree or blob, you do it from here.
func OpenRepository ¶
func OpenRepository(path string) (*Repository, error)
Open the repository at the given path.
func (*Repository) CommitsBefore ¶
func (repo *Repository) CommitsBefore(commitId string) (*list.List, error)
func (*Repository) CommitsBetween ¶
used only for single tree, (]
func (*Repository) CommitsByRange ¶
GetCommitsByRange returns certain number of commits with given page of repository.
func (*Repository) CommitsCount ¶
func (repo *Repository) CommitsCount(commitId string) (int, error)
func (*Repository) GetBranches ¶
func (repo *Repository) GetBranches() ([]string, error)
GetBranches returns all branches of given repository.
func (*Repository) GetCommit ¶
func (repo *Repository) GetCommit(commitId string) (*Commit, error)
Find the commit object in the repository.
func (*Repository) GetCommitIdOfBranch ¶
func (repo *Repository) GetCommitIdOfBranch(branchName string) (string, error)
func (*Repository) GetCommitIdOfTag ¶
func (repo *Repository) GetCommitIdOfTag(tagName string) (string, error)
func (*Repository) GetCommitOfBranch ¶
func (repo *Repository) GetCommitOfBranch(branchName string) (*Commit, error)
get branch's last commit or a special commit by id string
func (*Repository) GetCommitOfRelPath ¶
func (repo *Repository) GetCommitOfRelPath(commitId, relPath string) (*Commit, error)
func (*Repository) GetCommitOfTag ¶
func (repo *Repository) GetCommitOfTag(tagName string) (*Commit, error)
func (*Repository) GetTags ¶
func (repo *Repository) GetTags() ([]string, error)
GetTags returns all tags of given repository.
func (*Repository) GetTree ¶
func (repo *Repository) GetTree(idStr string) (*Tree, error)
Find the tree object in the repository.
func (*Repository) IsBranchExist ¶
func (repo *Repository) IsBranchExist(branchName string) bool
func (*Repository) IsTagExist ¶
func (repo *Repository) IsTagExist(tagName string) bool
func (*Repository) SearchCommits ¶
func (repo *Repository) SearchCommits(commitId, keyword string) (*list.List, error)
SearchCommits searches commits in given commitId and keyword of repository.
func (*Repository) Type ¶
func (repo *Repository) Type(id sha1) (ObjectType, error)
Get the type of an object.
type Tree ¶
type Tree struct { Id sha1 // contains filtered or unexported fields }
A tree is a flat directory listing.
func NewTree ¶
func NewTree(repo *Repository, id sha1) *Tree
func (*Tree) GetTreeEntryByPath ¶
func (*Tree) ListEntries ¶
type TreeEntry ¶
type TreeEntry struct { Id sha1 Type ObjectType // contains filtered or unexported fields }