Versions in this module Expand all Collapse all v1 v1.2.3 Aug 1, 2021 Changes in this version + var ErrNoSuchFile = errors.New("no such file") type Commit + func (c *Commit) ExistsFile(filename string) (bool, error) v1.2.2 Apr 20, 2021 Changes in this version type InitOptions + DefaultBranch string v1.2.1 Mar 7, 2021 Changes in this version type Commit + func (c *Commit) ReadFileSimple(filename string) ([]byte, error) v1.2.0 Feb 22, 2021 Changes in this version + const DefaultHooksDir + const DefaultTimeout + const EmptyID + const LogFormatHashOnly + const RefsHeads + const RefsTags + var ErrExecTimeout = errors.New("execution was timed out") + var ErrNoMergeBase = errors.New("no merge based was found") + var ErrNotBlob = errors.New("the entry is not a blob") + var ErrParentNotExist = errors.New("parent does not exist") + var ErrReferenceNotExist = errors.New("reference does not exist") + var ErrRemoteNotExist = errors.New("remote does not exist") + var ErrRevisionNotExist = errors.New("revision does not exist") + var ErrSubmoduleNotExist = errors.New("submodule does not exist") + var ServerSideHookSamples = map[HookName]string + var ServerSideHooks = []HookName + func BinVersion() (string, error) + func Clone(url, dst string, opts ...CloneOptions) error + func Init(path string, opts ...InitOptions) error + func IsURLAccessible(timeout time.Duration, url string) bool + func RefShortName(ref string) string + func RepoAdd(repoPath string, opts ...AddOptions) error + func RepoAddRemote(repoPath, name, url string, opts ...AddRemoteOptions) error + func RepoCheckout(repoPath, branch string, opts ...CheckoutOptions) error + func RepoCommit(repoPath string, committer *Signature, message string, opts ...CommitOptions) error + func RepoDeleteBranch(repoPath, name string, opts ...DeleteBranchOptions) error + func RepoDiffNameOnly(repoPath, base, head string, opts ...DiffNameOnlyOptions) ([]string, error) + func RepoFsck(repoPath string, opts ...FsckOptions) error + func RepoHasBranch(repoPath, branch string, opts ...ShowRefVerifyOptions) bool + func RepoHasReference(repoPath, ref string, opts ...ShowRefVerifyOptions) bool + func RepoHasTag(repoPath, tag string, opts ...ShowRefVerifyOptions) bool + func RepoMergeBase(repoPath, base, head string, opts ...MergeBaseOptions) (string, error) + func RepoMove(repoPath, src, dst string, opts ...MoveOptions) error + func RepoPush(repoPath, remote, branch string, opts ...PushOptions) error + func RepoRemoveRemote(repoPath, name string, opts ...RemoveRemoteOptions) error + func RepoReset(repoPath, rev string, opts ...ResetOptions) error + func RepoShowRefVerify(repoPath, ref string, opts ...ShowRefVerifyOptions) (string, error) + func RepoTags(repoPath string, opts ...TagsOptions) ([]string, error) + func SetOutput(output io.Writer) + func SetPrefix(prefix string) + func StreamParseDiff(r io.Reader, done chan<- SteamParseDiffResult, ...) + func UnescapeChars(in []byte) []byte + type AddOptions struct + All bool + Pathsepcs []string + Timeout time.Duration + type AddRemoteOptions struct + Fetch bool + MirrorFetch bool + Timeout time.Duration + type ArchiveFormat string + const ArchiveTarGz + const ArchiveZip + type Blame struct + func (b *Blame) Line(i int) *Commit + type BlameOptions struct + Timeout time.Duration + type Blob struct + func (b *Blob) Bytes() ([]byte, error) + func (b *Blob) Pipeline(stdout, stderr io.Writer) error + type CatFileCommitOptions struct + Timeout time.Duration + type CatFileTypeOptions struct + Timeout time.Duration + type CheckoutOptions struct + BaseBranch string + Timeout time.Duration + type CloneOptions struct + Bare bool + Branch string + Mirror bool + Quiet bool + Timeout time.Duration + type Command struct + func NewCommand(args ...string) *Command + func (c *Command) AddArgs(args ...string) *Command + func (c *Command) AddEnvs(envs ...string) *Command + func (c *Command) Run() ([]byte, error) + func (c *Command) RunInDir(dir string) ([]byte, error) + func (c *Command) RunInDirPipeline(stdout, stderr io.Writer, dir string) error + func (c *Command) RunInDirPipelineWithTimeout(timeout time.Duration, stdout, stderr io.Writer, dir string) (err error) + func (c *Command) RunInDirWithTimeout(timeout time.Duration, dir string) ([]byte, error) + func (c *Command) RunWithTimeout(timeout time.Duration) ([]byte, error) + func (c *Command) String() string + type Commit struct + Author *Signature + Committer *Signature + ID *SHA1 + Message string + func RepoLog(repoPath, rev string, opts ...LogOptions) ([]*Commit, error) + func (c *Commit) Ancestors(opts ...LogOptions) ([]*Commit, error) + func (c *Commit) CommitByPath(opts ...CommitByRevisionOptions) (*Commit, error) + func (c *Commit) CommitsAfter(after string, opts ...RevListOptions) ([]*Commit, error) + func (c *Commit) CommitsByPage(page, size int, opts ...CommitsByPageOptions) ([]*Commit, error) + func (c *Commit) CommitsCount(opts ...RevListCountOptions) (int64, error) + func (c *Commit) CreateArchive(format ArchiveFormat, dst string) error + func (c *Commit) FilesChangedAfter(after string, opts ...DiffNameOnlyOptions) ([]string, error) + func (c *Commit) IsImageFile(subpath string) (bool, error) + func (c *Commit) IsImageFileByIndex(index string) (bool, error) + func (c *Commit) Parent(n int, opts ...CatFileCommitOptions) (*Commit, error) + func (c *Commit) ParentID(n int) (*SHA1, error) + func (c *Commit) ParentsCount() int + func (c *Commit) SearchCommits(pattern string, opts ...SearchCommitsOptions) ([]*Commit, error) + func (c *Commit) ShowNameStatus(opts ...ShowNameStatusOptions) (*NameStatus, error) + func (c *Commit) Submodule(path string) (*Submodule, error) + func (c *Commit) Submodules() (Submodules, error) + func (c *Commit) Summary() string + type CommitByRevisionOptions struct + Path string + Timeout time.Duration + type CommitOptions struct + Author *Signature + Timeout time.Duration + type CommitsByPageOptions struct + Path string + Timeout time.Duration + type CommitsInfoOptions struct + MaxConcurrency int + Path string + Timeout time.Duration + type CommitsSinceOptions struct + Path string + Timeout time.Duration + type CountObject struct + Count int64 + Garbage int64 + InPack int64 + Packs int64 + PrunePackable int64 + Size int64 + SizeGarbage int64 + SizePack int64 + func RepoCountObjects(repoPath string, opts ...CountObjectsOptions) (*CountObject, error) + type CountObjectsOptions struct + Timeout time.Duration + type CreateTagOptions struct + Timeout time.Duration + type DeleteBranchOptions struct + Force bool + Timeout time.Duration + type DeleteTagOptions struct + Timeout time.Duration + type Diff struct + Files []*DiffFile + func (d *Diff) IsIncomplete() bool + func (d *Diff) NumFiles() int + func (d *Diff) TotalAdditions() int + func (d *Diff) TotalDeletions() int + type DiffBinaryOptions struct + Timeout time.Duration + type DiffFile struct + Index string + Name string + Sections []*DiffSection + Type DiffFileType + func (f *DiffFile) IsBinary() bool + func (f *DiffFile) IsCreated() bool + func (f *DiffFile) IsDeleted() bool + func (f *DiffFile) IsIncomplete() bool + func (f *DiffFile) IsRenamed() bool + func (f *DiffFile) IsSubmodule() bool + func (f *DiffFile) NumAdditions() int + func (f *DiffFile) NumDeletions() int + func (f *DiffFile) NumSections() int + func (f *DiffFile) OldName() string + type DiffFileType uint8 + const DiffFileAdd + const DiffFileChange + const DiffFileDelete + const DiffFileRename + type DiffLine struct + Content string + LeftLine int + RightLine int + Type DiffLineType + type DiffLineType uint8 + const DiffLineAdd + const DiffLineDelete + const DiffLinePlain + const DiffLineSection + type DiffNameOnlyOptions struct + NeedsMergeBase bool + Path string + Timeout time.Duration + type DiffOptions struct + Base string + Timeout time.Duration + type DiffSection struct + Lines []*DiffLine + func (s *DiffSection) Line(typ DiffLineType, line int) *DiffLine + func (s *DiffSection) NumLines() int + type Entries []*TreeEntry + func (es Entries) CommitsInfo(commit *Commit, opts ...CommitsInfoOptions) ([]*EntryCommitInfo, error) + func (es Entries) Len() int + func (es Entries) Less(i, j int) bool + func (es Entries) Sort() + func (es Entries) Swap(i, j int) + type EntryCommitInfo struct + Commit *Commit + Entry *TreeEntry + Index int + Submodule *Submodule + type EntryMode int + const EntryBlob + const EntryCommit + const EntryExec + const EntrySymlink + const EntryTree + type FetchOptions struct + Prune bool + Timeout time.Duration + type FsckOptions struct + Args []string + Timeout time.Duration + type Hook struct + func (h *Hook) Content() string + func (h *Hook) IsSample() bool + func (h *Hook) Name() HookName + func (h *Hook) Path() string + func (h *Hook) Update(content string) error + type HookName string + const HookPostReceive + const HookPreReceive + const HookUpdate + type InitOptions struct + Bare bool + Timeout time.Duration + type LatestCommitTimeOptions struct + Branch string + Timeout time.Duration + type LogOptions struct + GrepPattern string + MaxCount int + Path string + RegexpIgnoreCase bool + Since time.Time + Skip int + Timeout time.Duration + type LsRemoteOptions struct + Heads bool + Patterns []string + Refs bool + Tags bool + Timeout time.Duration + type LsTreeOptions struct + Timeout time.Duration + type MergeBaseOptions struct + Timeout time.Duration + type MoveOptions struct + Timeout time.Duration + type NameStatus struct + Added []string + Modified []string + Removed []string + func RepoShowNameStatus(repoPath, rev string, opts ...ShowNameStatusOptions) (*NameStatus, error) + type ObjectType string + const ObjectBlob + const ObjectCommit + const ObjectTag + const ObjectTree + type PullOptions struct + All bool + Branch string + Rebase bool + Remote string + Timeout time.Duration + type PushOptions struct + Envs []string + Timeout time.Duration + type RawDiffFormat string + const RawDiffNormal + const RawDiffPatch + type RawDiffOptions struct + Timeout time.Duration + type Reference struct + ID string + Refspec string + func LsRemote(url string, opts ...LsRemoteOptions) ([]*Reference, error) + type RemoveRemoteOptions struct + Timeout time.Duration + type Repository struct + func Open(repoPath string) (*Repository, error) + func (r *Repository) Add(opts ...AddOptions) error + func (r *Repository) AddRemote(name, url string, opts ...AddRemoteOptions) error + func (r *Repository) BlameFile(rev, file string, opts ...BlameOptions) (*Blame, error) + func (r *Repository) BranchCommit(branch string, opts ...CatFileCommitOptions) (*Commit, error) + func (r *Repository) BranchCommitID(branch string, opts ...ShowRefVerifyOptions) (string, error) + func (r *Repository) Branches() ([]string, error) + func (r *Repository) CatFileCommit(rev string, opts ...CatFileCommitOptions) (*Commit, error) + func (r *Repository) CatFileType(rev string, opts ...CatFileTypeOptions) (ObjectType, error) + func (r *Repository) Checkout(branch string, opts ...CheckoutOptions) error + func (r *Repository) Commit(committer *Signature, message string, opts ...CommitOptions) error + func (r *Repository) CommitByRevision(rev string, opts ...CommitByRevisionOptions) (*Commit, error) + func (r *Repository) CommitsByPage(rev string, page, size int, opts ...CommitsByPageOptions) ([]*Commit, error) + func (r *Repository) CommitsSince(rev string, since time.Time, opts ...CommitsSinceOptions) ([]*Commit, error) + func (r *Repository) CountObjects(opts ...CountObjectsOptions) (*CountObject, error) + func (r *Repository) CreateTag(name, rev string, opts ...CreateTagOptions) error + func (r *Repository) DeleteBranch(name string, opts ...DeleteBranchOptions) error + func (r *Repository) DeleteTag(name string, opts ...DeleteTagOptions) error + func (r *Repository) Diff(rev string, maxFiles, maxFileLines, maxLineChars int, opts ...DiffOptions) (*Diff, error) + func (r *Repository) DiffBinary(base, head string, opts ...DiffBinaryOptions) ([]byte, error) + func (r *Repository) DiffNameOnly(base, head string, opts ...DiffNameOnlyOptions) ([]string, error) + func (r *Repository) Fetch(opts ...FetchOptions) error + func (r *Repository) Fsck(opts ...FsckOptions) error + func (r *Repository) HasBranch(branch string, opts ...ShowRefVerifyOptions) bool + func (r *Repository) HasReference(ref string, opts ...ShowRefVerifyOptions) bool + func (r *Repository) HasTag(tag string, opts ...ShowRefVerifyOptions) bool + func (r *Repository) Hook(dir string, name HookName) (*Hook, error) + func (r *Repository) Hooks(dir string) ([]*Hook, error) + func (r *Repository) LatestCommitTime(opts ...LatestCommitTimeOptions) (time.Time, error) + func (r *Repository) Log(rev string, opts ...LogOptions) ([]*Commit, error) + func (r *Repository) LsTree(rev string, opts ...LsTreeOptions) (*Tree, error) + func (r *Repository) MergeBase(base, head string, opts ...MergeBaseOptions) (string, error) + func (r *Repository) Move(src, dst string, opts ...MoveOptions) error + func (r *Repository) NewHook(dir string, name HookName) *Hook + func (r *Repository) Path() string + func (r *Repository) Pull(opts ...PullOptions) error + func (r *Repository) Push(remote, branch string, opts ...PushOptions) error + func (r *Repository) RawDiff(rev string, diffType RawDiffFormat, w io.Writer, opts ...RawDiffOptions) error + func (r *Repository) RemoveRemote(name string, opts ...RemoveRemoteOptions) error + func (r *Repository) Reset(rev string, opts ...ResetOptions) error + func (r *Repository) RevList(refspecs []string, opts ...RevListOptions) ([]*Commit, error) + func (r *Repository) RevListCount(refspecs []string, opts ...RevListCountOptions) (int64, error) + func (r *Repository) RevParse(rev string, opts ...RevParseOptions) (string, error) + func (r *Repository) SearchCommits(rev, pattern string, opts ...SearchCommitsOptions) ([]*Commit, error) + func (r *Repository) ShowNameStatus(rev string, opts ...ShowNameStatusOptions) (*NameStatus, error) + func (r *Repository) ShowRef(opts ...ShowRefOptions) ([]*Reference, error) + func (r *Repository) ShowRefVerify(ref string, opts ...ShowRefVerifyOptions) (string, error) + func (r *Repository) SymbolicRef(opts ...SymbolicRefOptions) (string, error) + func (r *Repository) Tag(name string, opts ...TagOptions) (*Tag, error) + func (r *Repository) TagCommit(tag string, opts ...CatFileCommitOptions) (*Commit, error) + func (r *Repository) TagCommitID(tag string, opts ...ShowRefVerifyOptions) (string, error) + func (r *Repository) Tags(opts ...TagsOptions) ([]string, error) + type ResetOptions struct + Hard bool + Timeout time.Duration + type RevListCountOptions struct + Path string + Timeout time.Duration + type RevListOptions struct + Path string + Timeout time.Duration + type RevParseOptions struct + Timeout time.Duration + type SHA1 struct + func MustID(b []byte) *SHA1 + func MustIDFromString(s string) *SHA1 + func NewID(b []byte) (*SHA1, error) + func NewIDFromString(s string) (*SHA1, error) + func (s *SHA1) Equal(s2 interface{}) bool + func (s *SHA1) String() string + type SearchCommitsOptions struct + MaxCount int + Path string + Timeout time.Duration + type ShowNameStatusOptions struct + Timeout time.Duration + type ShowRefOptions struct + Heads bool + Patterns []string + Tags bool + Timeout time.Duration + type ShowRefVerifyOptions struct + Timeout time.Duration + type Signature struct + Email string + Name string + When time.Time + type SteamParseDiffResult struct + Diff *Diff + Err error + type Submodule struct + Commit string + Name string + URL string + type Submodules = *objectCache + type SymbolicRefOptions struct + Name string + Ref string + Timeout time.Duration + type Tag struct + func (t *Tag) Commit(opts ...CatFileCommitOptions) (*Commit, error) + func (t *Tag) CommitID() *SHA1 + func (t *Tag) ID() *SHA1 + func (t *Tag) Message() string + func (t *Tag) Refspec() string + func (t *Tag) Tagger() *Signature + func (t *Tag) Type() ObjectType + type TagOptions struct + Timeout time.Duration + type TagsOptions struct + Timeout time.Duration + type Tree struct + func (t *Tree) Blob(subpath string, opts ...LsTreeOptions) (*Blob, error) + func (t *Tree) BlobByIndex(index string) (*Blob, error) + func (t *Tree) Entries(opts ...LsTreeOptions) (Entries, error) + func (t *Tree) Subtree(subpath string, opts ...LsTreeOptions) (*Tree, error) + func (t *Tree) TreeEntry(subpath string, opts ...LsTreeOptions) (*TreeEntry, error) + type TreeEntry struct + func (e *TreeEntry) Blob() *Blob + func (e *TreeEntry) ID() *SHA1 + func (e *TreeEntry) IsBlob() bool + func (e *TreeEntry) IsCommit() bool + func (e *TreeEntry) IsExec() bool + func (e *TreeEntry) IsSymlink() bool + func (e *TreeEntry) IsTree() bool + func (e *TreeEntry) Mode() EntryMode + func (e *TreeEntry) Name() string + func (e *TreeEntry) Size() int64 + func (e *TreeEntry) Type() ObjectType