Versions in this module Expand all Collapse all v0 v0.1.0 Oct 13, 2026 Changes in this version + var ErrClosed = errors.New("repository is closed") + var ErrDirectoryNotFound = errors.New("directory not found") + var ErrEntryNotFound = errors.New("entry not found") + var ErrFault = errors.New("git2: internal fault") + var ErrFileNotFound = errors.New("file not found") + var ErrHashOrReference = errors.New("ambiguous options, only one of CommitHash or ReferenceName can be passed") + var ErrInvalidType = errors.New("invalid object type") + var ErrMalformedCommit = errors.New("malformed commit") + var ErrMalformedTag = errors.New("malformed tag") + var ErrMalformedTree = errors.New("malformed tree") + var ErrObjectNotFound = errors.New("object not found") + var ErrReferenceNotFound = errors.New("reference not found") + var ErrRepositoryNotExists = errors.New("repository does not exist") + var ErrStop = errors.New("stop iter") + var ErrTagNotFound = errors.New("tag not found") + var ErrUnsupportedObject = errors.New("unsupported object type") + var ErrUnsupportedOrder = errors.New("unsupported log order") + func IsHash(s string) bool + func Licenses() string + type Blob struct + Hash Hash + Size int64 + func (b *Blob) Bytes(dst []byte) ([]byte, error) + func (b *Blob) ID() Hash + func (b *Blob) Reader() (io.ReadCloser, error) + func (b *Blob) Type() ObjectType + type Commit struct + Author Signature + Committer Signature + Encoding string + Hash Hash + MergeTag string + Message string + PGPSignature string + ParentHashes []Hash + TreeHash Hash + func (c *Commit) File(path string) (*File, error) + func (c *Commit) Files() (*FileIter, error) + func (c *Commit) ID() Hash + func (c *Commit) NumParents() int + func (c *Commit) Parent(i int) (*Commit, error) + func (c *Commit) Parents() *CommitIter + func (c *Commit) String() string + func (c *Commit) Tree() (*Tree, error) + func (c *Commit) Type() ObjectType + type CommitIter struct + func (it *CommitIter) Close() + func (it *CommitIter) ForEach(fn func(*Commit) error) error + func (it *CommitIter) Next() (*Commit, error) + func (it *CommitIter) NextHash() (Hash, error) + type Error struct + Class int + Code int + Message string + func (e *Error) Error() string + type FS interface + Lstat func(name string) (fs.FileInfo, error) + Open func(name string) (FSFile, error) + Readlink func(name string) (string, error) + Stat func(name string) (fs.FileInfo, error) + func FromFS(fsys fs.FS) FS + type FSFile = wasi.File + type FaultError struct + Stack []byte + Value any + func (e *FaultError) Error() string + func (e *FaultError) Unwrap() error + type File struct + Hash Hash + Mode FileMode + Name string + func (f *File) Blob() (*Blob, error) + func (f *File) Bytes(dst []byte) ([]byte, error) + func (f *File) Contents() (string, error) + func (f *File) Lines() ([]string, error) + func (f *File) Reader() (io.ReadCloser, error) + func (f *File) Size() (int64, error) + type FileIter struct + func (it *FileIter) Close() + func (it *FileIter) ForEach(fn func(*File) error) error + func (it *FileIter) Next() (*File, error) + type FileMode uint32 + const Deprecated + const Dir + const Empty + const Executable + const Regular + const Submodule + const Symlink + func (m FileMode) IsFile() bool + func (m FileMode) IsMalformed() bool + func (m FileMode) IsRegular() bool + func (m FileMode) String() string + func (m FileMode) ToOSFileMode() (os.FileMode, error) + type GrepOptions struct + CommitHash Hash + InvertMatch bool + PathSpecs []*regexp.Regexp + Patterns []*regexp.Regexp + ReferenceName ReferenceName + type GrepResult struct + Content string + FileName string + LineNumber int + TreeName string + func (gr GrepResult) String() string + type Hash [20]byte + var ZeroHash Hash + func ComputeHash(t ObjectType, content []byte) Hash + func NewHash(s string) Hash + func (h Hash) IsZero() bool + func (h Hash) String() string + type Hasher struct + func NewHasher(t ObjectType, size int64) Hasher + func (h Hasher) Sum() (id Hash) + type LogOptions struct + All bool + FileName *string + From Hash + Order LogOrder + PathFilter func(string) bool + Since *time.Time + Until *time.Time + type LogOrder int8 + const LogOrderBSF + const LogOrderCommitterTime + const LogOrderDFS + const LogOrderDFSPost + const LogOrderDefault + type ObjectType int8 + const AnyObject + const BlobObject + const CommitObject + const InvalidObject + const TagObject + const TreeObject + func (t ObjectType) String() string + type OpenOptions struct + SkipHashVerification bool + type Reference struct + func NewHashReference(n ReferenceName, h Hash) *Reference + func NewSymbolicReference(n, target ReferenceName) *Reference + func (r *Reference) Hash() Hash + func (r *Reference) Name() ReferenceName + func (r *Reference) String() string + func (r *Reference) Target() ReferenceName + func (r *Reference) Type() ReferenceType + type ReferenceIter struct + func (it *ReferenceIter) Close() + func (it *ReferenceIter) ForEach(fn func(*Reference) error) error + func (it *ReferenceIter) Len() int + func (it *ReferenceIter) Next() (*Reference, error) + type ReferenceName string + const HEAD + const Main + const Master + func NewBranchReferenceName(name string) ReferenceName + func NewRemoteReferenceName(remote, name string) ReferenceName + func NewTagReferenceName(name string) ReferenceName + func (r ReferenceName) IsBranch() bool + func (r ReferenceName) IsNote() bool + func (r ReferenceName) IsRemote() bool + func (r ReferenceName) IsTag() bool + func (r ReferenceName) Short() string + func (r ReferenceName) String() string + type ReferenceType int8 + const HashReference + const InvalidReference + const SymbolicReference + func (t ReferenceType) String() string + type Repository struct + func Open(fsys FS) (*Repository, error) + func OpenWithOptions(fsys FS, o *OpenOptions) (*Repository, error) + func PlainOpen(path string) (*Repository, error) + func PlainOpenWithOptions(path string, o *OpenOptions) (*Repository, error) + func (r *Repository) BlobObject(h Hash) (_ *Blob, err error) + func (r *Repository) Branches() (*ReferenceIter, error) + func (r *Repository) Close() error + func (r *Repository) CommitObject(h Hash) (_ *Commit, err error) + func (r *Repository) Grep(o *GrepOptions) ([]GrepResult, error) + func (r *Repository) HasObject(h Hash) (_ bool, err error) + func (r *Repository) Head() (*Reference, error) + func (r *Repository) IsShallow() (_ bool, err error) + func (r *Repository) Log(o *LogOptions) (*CommitIter, error) + func (r *Repository) ObjectHeader(h Hash) (_ ObjectType, _ int64, err error) + func (r *Repository) ReadBlob(h Hash, dst []byte) (_ []byte, err error) + func (r *Repository) Reference(name ReferenceName, resolved bool) (_ *Reference, err error) + func (r *Repository) References() (*ReferenceIter, error) + func (r *Repository) ResolveRevision(rev Revision) (_ *Hash, err error) + func (r *Repository) Tag(name string) (*Reference, error) + func (r *Repository) TagObject(h Hash) (_ *Tag, err error) + func (r *Repository) Tags() (*ReferenceIter, error) + func (r *Repository) TreeObject(h Hash) (_ *Tree, err error) + type Revision string + type Signature struct + Email string + Name string + When time.Time + func (s Signature) String() string + type Tag struct + Hash Hash + Message string + Name string + PGPSignature string + Tagger Signature + Target Hash + TargetType ObjectType + func (t *Tag) Blob() (*Blob, error) + func (t *Tag) Commit() (*Commit, error) + func (t *Tag) ID() Hash + func (t *Tag) Tree() (*Tree, error) + func (t *Tag) Type() ObjectType + type Tree struct + Entries []TreeEntry + Hash Hash + func (t *Tree) File(p string) (*File, error) + func (t *Tree) Files() *FileIter + func (t *Tree) FindEntry(p string) (_ *TreeEntry, err error) + func (t *Tree) ID() Hash + func (t *Tree) Paths(fn func(path string, mode FileMode, h Hash) error) error + func (t *Tree) Tree(p string) (*Tree, error) + func (t *Tree) TreeEntryFile(e *TreeEntry) (*File, error) + func (t *Tree) Type() ObjectType + type TreeEntry struct + Hash Hash + Mode FileMode + Name string + type TreeWalker struct + func NewTreeWalker(t *Tree, recursive bool) *TreeWalker + func (w *TreeWalker) Close() + func (w *TreeWalker) Next() (string, TreeEntry, error)