Versions in this module Expand all Collapse all v0 v0.0.2 Aug 22, 2021 Changes in this version + const ItemsPerPage + const ItemsPerSearch + var ErrBranchExisted = errors.New("branch has existed") + var ErrNotExist = errors.New("error not exist") + var IdNotExist = errors.New("sha1 id not exist") + var TreeEntryRe = regexp.MustCompile("^([0-9]+) ([^\x00]+)\x00") + func CreateBranch(repoPath, branchName, id string) error + func CreateRef(head, repoPath, branchName, id string) error + func CreateTag(repoPath, tagName, id string) error + func IntToStr(n int) string + func IsBranchExist(repoPath, branchName string) bool + func IsSha1(sha1 string) bool + func NewId(b []byte) (sha1, error) + func NewIdFromString(s string) (sha1, error) + func ParseModeType(modeString string) (EntryMode, ObjectType, error) + func PrependObjectHeader(objectType ObjectType, r io.ReadSeeker) (io.Reader, error) + func RefEndName(refStr string) string + func ScanTreeEntry(data []byte, atEOF bool) (advance int, token []byte, err error) + func StoreObjectSHA(objectType ObjectType, w io.Writer, r io.ReadSeeker) (sha1, error) + func StrToInt(str string) (int, error) + func UnpackRefs(repoPath string) error + type ArchiveType int + const AT_TARGZ + const AT_ZIP + type Blob struct + func (b *Blob) Data() (io.ReadCloser, error) + type Commit struct + Author *Signature + CommitMessage string + Committer *Signature + Id sha1 + 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 + func (c *Commit) TreeId() sha1 + type CommitComparator func(current, parent *Commit) bool + type CommitWalkCallback func(*Commit) (HistoryWalkerAction, error) + type Entries []*TreeEntry + func (bs Entries) Len() int + func (bs Entries) Less(i, j int) bool + func (bs Entries) Sort() + func (bs Entries) Swap(i, j int) + type EntryMode int + const ModeBlob + const ModeCommit + const ModeExec + const ModeSymlink + const ModeTree + type HistoryWalkerAction int + const HWDrop + const HWFollowParents + const HWStop + const HWTakeAndFollow + const HWTakeCommit + type ObjectType int + const ObjectBlob + const ObjectCommit + const ObjectTag + const ObjectTree + func (t ObjectType) String() string + type Repository struct + Path string + func OpenRepository(path string) (*Repository, error) + func (repo *Repository) CommitsBefore(commitId string) (*list.List, error) + 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) CommitsByRange(commitId string, page int) (*list.List, error) + func (repo *Repository) CommitsCount(commitId string) (int, error) + func (repo *Repository) CreateBranch(branchName, idStr string) 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) GetCommitOfRelPath(commitId, relPath 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) HaveObject(idStr string) (found, packed bool, err error) + func (repo *Repository) HaveObjectFromReadSeeker(objectType ObjectType, r io.ReadSeeker) (found bool, id sha1, err 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) StoreObjectLoose(objectType ObjectType, r io.ReadSeeker) (sha1, error) + func (repo *Repository) TagPath(tagName string) string + type Signature struct + Email string + Name string + When time.Time + func (s Signature) String() string + type Tag struct + Id sha1 + Name string + Object sha1 + TagMessage string + Tagger *Signature + Type string + func (tag *Tag) Commit() (*Commit, error) + type Tree struct + Id sha1 + func NewTree(repo *Repository, id sha1) *Tree + func (t *Tree) GetBlobByPath(rpath string) (*Blob, error) + func (t *Tree) GetTreeEntryByPath(rpath string) (*TreeEntry, error) + func (t *Tree) ListEntries() Entries + func (t *Tree) Scanner() (*TreeScanner, error) + func (t *Tree) SubTree(rpath string) (*Tree, error) + type TreeEntry struct + Id sha1 + Type ObjectType + 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 TreeScanner struct + func NewTreeScanner(parent *Tree, rc io.ReadCloser) *TreeScanner + func (t *TreeScanner) Err() error + func (t *TreeScanner) Scan() bool + func (t *TreeScanner) TreeEntry() *TreeEntry + type TreeWalkCallback func(string, *TreeEntry) int