Documentation ¶
Index ¶
- Variables
- func IsBranchExist(repoPath, branchName 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
- type ArchiveType
- 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(path string, archiveType ArchiveType) 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
- type Entries
- type EntryMode
- type ObjectType
- type Repository
- func (repo *Repository) CommitsBetween(last *Commit, before *Commit) (*list.List, error)
- func (repo *Repository) CommitsByFileAndRange(branch, file string, page int) (*list.List, error)
- func (repo *Repository) CommitsCount(commitId string) (int, error)
- func (repo *Repository) CreateTag(tagName, idStr string) error
- func (repo *Repository) FileCommitsCount(branch, file 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) GetCommitOfTag(tagName string) (*Commit, error)
- func (repo *Repository) GetTag(tagName string) (*Tag, 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
- type Signature
- type Tag
- type Tree
- type TreeEntry
- type Version
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotExist = errors.New("error not exist")
)
View Source
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 ¶
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 (c *Commit) CreateArchive(path string, archiveType ArchiveType) error
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 ObjectType ¶
type ObjectType string
const ( COMMIT ObjectType = "commit" TREE ObjectType = "tree" BLOB ObjectType = "blob" TAG ObjectType = "tag" )
type Repository ¶
type Repository struct { Path string // contains filtered or unexported fields }
Repository represents a Git repository.
func OpenRepository ¶
func OpenRepository(repoPath string) (*Repository, error)
OpenRepository opens the repository at the given path.
func (*Repository) CommitsBetween ¶
used only for single tree, (]
func (*Repository) CommitsByFileAndRange ¶
func (*Repository) CommitsCount ¶
func (repo *Repository) CommitsCount(commitId string) (int, error)
func (*Repository) CreateTag ¶
func (repo *Repository) CreateTag(tagName, idStr string) error
func (*Repository) FileCommitsCount ¶
func (repo *Repository) FileCommitsCount(branch, file string) (int, error)
func (*Repository) GetBranches ¶
func (repo *Repository) GetBranches() ([]string, error)
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) GetCommitOfTag ¶
func (repo *Repository) GetCommitOfTag(tagName string) (*Commit, error)
func (*Repository) GetTag ¶
func (repo *Repository) GetTag(tagName string) (*Tag, error)
GetTag returns a Git tag by given name.
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
type Tag ¶
type Tag struct { Name string Id sha1 Object sha1 // The id of this commit object Type string Tagger *Signature TagMessage string // contains filtered or unexported fields }
Tag represents a Git tag.
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 ¶
type TreeEntry ¶
type TreeEntry struct { Id sha1 Type ObjectType // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.