git package - github.com/libgit2/git2go/v34 - Go Packages (original) (raw)

View Source

const ( CredTypeUserpassPlaintext = CredentialTypeUserpassPlaintext CredTypeSshKey = CredentialTypeSSHKey CredTypeSshCustom = CredentialTypeSSHCustom CredTypeDefault = CredentialTypeDefault )

View Source

const (

ErrClassNone = [ErrorClassNone](#ErrorClassNone)

ErrClassNoMemory = [ErrorClassNoMemory](#ErrorClassNoMemory)

ErrClassOs = [ErrorClassOS](#ErrorClassOS)

ErrClassInvalid = [ErrorClassInvalid](#ErrorClassInvalid)

ErrClassReference = [ErrorClassReference](#ErrorClassReference)

ErrClassZlib = [ErrorClassZlib](#ErrorClassZlib)

ErrClassRepository = [ErrorClassRepository](#ErrorClassRepository)

ErrClassConfig = [ErrorClassConfig](#ErrorClassConfig)

ErrClassRegex = [ErrorClassRegex](#ErrorClassRegex)

ErrClassOdb = [ErrorClassOdb](#ErrorClassOdb)

ErrClassIndex = [ErrorClassIndex](#ErrorClassIndex)

ErrClassObject = [ErrorClassObject](#ErrorClassObject)

ErrClassNet = [ErrorClassNet](#ErrorClassNet)

ErrClassTag = [ErrorClassTag](#ErrorClassTag)

ErrClassTree = [ErrorClassTree](#ErrorClassTree)

ErrClassIndexer = [ErrorClassIndexer](#ErrorClassIndexer)

ErrClassSSL = [ErrorClassSSL](#ErrorClassSSL)

ErrClassSubmodule = [ErrorClassSubmodule](#ErrorClassSubmodule)

ErrClassThread = [ErrorClassThread](#ErrorClassThread)

ErrClassStash = [ErrorClassStash](#ErrorClassStash)

ErrClassCheckout = [ErrorClassCheckout](#ErrorClassCheckout)

ErrClassFetchHead = [ErrorClassFetchHead](#ErrorClassFetchHead)

ErrClassMerge = [ErrorClassMerge](#ErrorClassMerge)

ErrClassSsh = [ErrorClassSSH](#ErrorClassSSH)

ErrClassFilter = [ErrorClassFilter](#ErrorClassFilter)

ErrClassRevert = [ErrorClassRevert](#ErrorClassRevert)

ErrClassCallback = [ErrorClassCallback](#ErrorClassCallback)

ErrClassRebase = [ErrorClassRebase](#ErrorClassRebase)

ErrClassPatch = [ErrorClassPatch](#ErrorClassPatch)

)

View Source

const (

ErrOk = [ErrorCodeOK](#ErrorCodeOK)

ErrGeneric = [ErrorCodeGeneric](#ErrorCodeGeneric)

ErrNotFound = [ErrorCodeNotFound](#ErrorCodeNotFound)

ErrExists = [ErrorCodeExists](#ErrorCodeExists)

ErrAmbiguous = [ErrorCodeAmbiguous](#ErrorCodeAmbiguous)

ErrAmbigious = [ErrorCodeAmbiguous](#ErrorCodeAmbiguous)

ErrBuffs = [ErrorCodeBuffs](#ErrorCodeBuffs)

ErrUser = [ErrorCodeUser](#ErrorCodeUser)

ErrBareRepo = [ErrorCodeBareRepo](#ErrorCodeBareRepo)

ErrUnbornBranch = [ErrorCodeUnbornBranch](#ErrorCodeUnbornBranch)

ErrUnmerged = [ErrorCodeUnmerged](#ErrorCodeUnmerged)

ErrNonFastForward = [ErrorCodeNonFastForward](#ErrorCodeNonFastForward)

ErrInvalidSpec = [ErrorCodeInvalidSpec](#ErrorCodeInvalidSpec)

ErrConflict = [ErrorCodeConflict](#ErrorCodeConflict)

ErrLocked = [ErrorCodeLocked](#ErrorCodeLocked)

ErrModified = [ErrorCodeModified](#ErrorCodeModified)

ErrAuth = [ErrorCodeAuth](#ErrorCodeAuth)

ErrCertificate = [ErrorCodeCertificate](#ErrorCodeCertificate)

ErrApplied = [ErrorCodeApplied](#ErrorCodeApplied)

ErrPeel = [ErrorCodePeel](#ErrorCodePeel)

ErrEOF = [ErrorCodeEOF](#ErrorCodeEOF)

ErrUncommitted = [ErrorCodeUncommitted](#ErrorCodeUncommitted)

ErrDirectory = [ErrorCodeDirectory](#ErrorCodeDirectory)

ErrMergeConflict = [ErrorCodeMergeConflict](#ErrorCodeMergeConflict)

ErrPassthrough = [ErrorCodePassthrough](#ErrorCodePassthrough)

ErrIterOver = [ErrorCodeIterOver](#ErrorCodeIterOver)

ErrApplyFail = [ErrorCodeApplyFail](#ErrorCodeApplyFail)

)

Error returned if there is no current rebase operation

Special value indicating that there is no currently active operation

TreeWalkSkip is an error that can be returned form TreeWalkCallback to skip a subtree from being expanded.

func CachedMemory() (current int, allowed int, err error)

Deprecated: CallbackGitTreeWalk is not used.

ConfigFindProgramdata locate the path to the configuration file in ProgramData.

Look for the file in %PROGRAMDATA%\Git\config used by portable git.

DiffBlobs performs a diff between two arbitrary blobs. You can pass whatever file names you'd like for them to appear as in the diff.

func EnableStrictHashVerification(enabled bool) error

func GetCachedMemory() (current int, allowed int, err error)

deprecated: You should use `CachedMemory()` instead.

ReInit reinitializes the global state, this is useful if the effective user id has changed and you want to update the stored search paths for gitconfig files. This function frees any references to objects, so it should be called before any other functions are called.

Deprecated: ReferenceIsValidName is a deprecated alias of ReferenceNameIsValid.

ReferenceNameIsValid returns whether the reference name is well-formed.

Valid reference names must follow one of two patterns:

1. Top-level names must contain only capital letters and underscores, and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").

2. Names prefixed with "refs/" can be almost anything. You must avoid the characters '~', '^', ':', ' \ ', '?', '[', and '*', and the sequences ".." and " @ {" which have special meaning to revparse.

ReferenceNormalizeName normalizes the reference name and checks validity.

This will normalize the reference name by removing any leading slash '/' characters and collapsing runs of adjacent slashes between name components into a single slash.

See git_reference_symbolic_create() for rules about valid names.

Deprecated: RemoteIsValidName is a deprecated alias of RemoteNameIsValid.

RemoteNameIsValid returns whether the remote name is well-formed.

func SetCacheObjectLimit(objectType ObjectType, size int) error

func SetMwindowMappedLimit(size int) error

Shutdown frees all the resources acquired by libgit2. Make sure no references to any git2go objects are live before calling this. After this is called, invoking any function from this library will result in undefined behavior, so make sure this is called carefully.

func SubmoduleStatusIsUnmodified(status int) bool

Deprecated: SubmoduleVisitor is not used.

type AnnotatedCommit struct {

}

func (mh *AnnotatedCommit) Free()

func (mh *AnnotatedCommit) Id() *Oid

type ApplyDeltaCallback func(*DiffDelta) (apply bool, err error)

ApplyDeltaCallback is a callback that will be made per hunk when applying a patch.

type ApplyHunkCallback func(*DiffHunk) (apply bool, err error)

ApplyHunkCallback is a callback that will be made per delta (file) when applying a patch.

ApplyLocation represents the possible application locations for applying diffs.

type ApplyOptions struct { ApplyHunkCallback ApplyHunkCallback ApplyDeltaCallback ApplyDeltaCallback Flags uint }

ApplyOptions has 2 callbacks that are called for hunks or deltas If these functions return an error, abort the apply process immediately. If the first return value is true, the delta/hunk will be applied. If it is false, the delta/hunk will not be applied. In either case, the rest of the apply process will continue.

func DefaultApplyOptions() (*ApplyOptions, error)

DefaultApplyOptions returns default options for applying diffs or patches.

func (blame *Blame) HunkByIndex(index int) (BlameHunk, error)

func (blame *Blame) HunkByLine(lineno int) (BlameHunk, error)

func (blame *Blame) HunkCount() int

type BlameHunk struct { LinesInHunk uint16 FinalCommitId *Oid FinalStartLineNumber uint16 FinalSignature *Signature OrigCommitId *Oid OrigPath string OrigStartLineNumber uint16 OrigSignature *Signature Boundary bool }

type BlameOptions struct { Flags BlameOptionsFlag MinMatchCharacters uint16 NewestCommit *Oid OldestCommit *Oid MinLine uint32 MaxLine uint32 }

func DefaultBlameOptions() (BlameOptions, error)

type Blob struct { Object

}

func (b *Blob) AsObject() *Object

func (v *Blob) IsBinary() bool

type BlobCallbackData struct { Callback BlobChunkCallback Error error }

Deprecated: BlobCallbackData is not used.

Deprecated: BlobChunkCallback is not used.

type BlobWriteStream struct {

}

func (stream BlobWriteStream) Commit() (Oid, error)

func (stream *BlobWriteStream) Free()

type Branch struct { *Reference

}

type BranchIterator struct {

}

func (i *BranchIterator) Free()

type BranchIteratorFunc func(*Branch, BranchType) error

Certificate represents the two possible certificates which libgit2 knows it might find. If Kind is CertficateX509 then the X509 field will be filled. If Kind is CertificateHostkey then the Hostkey field will be filled.

type CertificateKind uint

type CheckoutNotifyCallback func(why CheckoutNotifyType, path string, baseline, target, workdir DiffFile) error

type CheckoutNotifyType uint

type CheckoutOpts = CheckoutOptions

Deprecated: CheckoutOpts is a deprecated alias of CheckoutOptions.

type CheckoutProgressCallback func(path string, completed, total uint)

type CheckoutStrategy uint

type CherrypickOptions struct { Mainline uint MergeOptions MergeOptions CheckoutOptions CheckoutOptions }

func DefaultCherrypickOptions() (CherrypickOptions, error)

type CloneOptions struct { CheckoutOptions CheckoutOptions FetchOptions FetchOptions Bare bool CheckoutBranch string RemoteCreateCallback RemoteCreateCallback }

type Commit struct { Object

}

Commit

func (c *Commit) AsObject() *Object

func (c *Commit) Author() *Signature

func (c *Commit) Committer() *Signature

func (*Commit) ContentToSign

func (c *Commit) ContentToSign() string

ContentToSign returns the content that will be passed to a signing function for this commit

Describe performs the describe operation on the commit.

func (c *Commit) MessageEncoding() MessageEncoding

func (c *Commit) Parent(n uint) *Commit

func (c *Commit) ParentCount() uint

func (c *Commit) ParentId(n uint) *Oid

RawHeader gets the full raw text of the commit header.

func (c *Commit) TreeId() *Oid

WithSignature creates a new signed commit from the given signature and signature field

func (c Commit) WithSignatureUsing(f CommitSigningCallback) (Oid, error)

WithSignatureUsing creates a new signed commit from this one using the given signing callback

type CommitCreateCallback func( author, committer *Signature, messageEncoding MessageEncoding, message string, tree Tree, parents ...Commit, ) (oid *Oid, err error)

CommitCreateCallback defines a function type that is called when another function is going to create commits (for example, Rebase) to allow callers to override the commit creation behavior. For example, users may wish to sign commits by providing this information to Repository.CreateCommitBuffer, signing that buffer, then calling Repository.CreateCommitWithSignature.

type CommitSigningCallback func(string) (signature, signatureField string, err error)

CommitSigningCallback defines a function type that takes some data to sign and returns (signature, signature_field, error)

type CompletionCallback func(RemoteCompletion) error

NewConfig creates a new empty configuration object

func OpenDefault() (*Config, error)

OpenDefault opens the default config according to git rules

OpenOndisk creates a new config instance containing a single on-disk file

AddFile adds a file-backed backend to the config object at the specified level.

func (c Config) NewIterator() (ConfigIterator, error)

NewIterator creates an iterator over each entry in the configuration

NewIteratorGlob creates an iterator over each entry in the configuration whose name matches the given regular expression

func (c *Config) OpenLevel(parent Config, level ConfigLevel) (Config, error)

OpenLevel creates a single-level focused config object from a multi-level one

func (c *Config) SetMultivar(name, regexp, value string) (err error)

type ConfigIterator struct {

}

func (iter *ConfigIterator) Free()

Next returns the next entry for this iterator

type ConnectDirection uint

Deprecated: Cred is a deprecated alias of Credential

func NewCredDefault() (*Cred, error)

Deprecated: NewCredDefault is a deprecated alias fof NewCredentialDefault.

Deprecated: NewCredSshKey is a deprecated alias of NewCredentialSshKey.

Deprecated: NewCredSshKeyFromAgent is a deprecated alias of NewCredentialSSHFromAgent.

Deprecated: NewCredSshKeyFromMemory is a deprecated alias of NewCredentialSSHKeyFromMemory.

Deprecated: NewCredUsername is a deprecated alias of NewCredentialUsername.

Deprecated: NewCredUserpassPlaintext is a deprecated alias of NewCredentialUserpassPlaintext.

type CredType = CredentialType

Deprecated: CredType is a deprecated alias of CredentialType

type Credential struct {

}

func NewCredentialDefault() (*Credential, error)

NewCredentialSSHKey creates new ssh credentials reading the public and private keys from the file system.

func NewCredentialSSHKeyFromAgent(username string) (*Credential, error)

NewCredentialSSHKeyFromMemory creates new ssh credentials using the publicKey and privateKey arguments as the values for the public and private keys.

NewCredentialSSHKeyFromSigner creates new SSH credentials using the provided signer.

func (o *Credential) Free()

func (o *Credential) GetSSHKey() (username, publickey, privatekey, passphrase string, err error)

GetSSHKey returns the SSH-specific key information from the Cred object.

func (o *Credential) GetUserpassPlaintext() (username, password string, err error)

GetUserpassPlaintext returns the plaintext username/password combination stored in the Cred.

func (o *Credential) HasUsername() bool

func (o *Credential) Type() CredentialType

CredentialType is a bitmask of supported credential types.

This represents the various types of authentication methods supported by the library.

type DescribeFormatOptions struct {

AbbreviatedSize [uint](/builtin#uint) 


AlwaysUseLongFormat [bool](/builtin#bool)


DirtySuffix [string](/builtin#string)

}

DescribeFormatOptions can be used for formatting the describe string.

You can use DefaultDescribeFormatOptions() to get default options.

func DefaultDescribeFormatOptions() (DescribeFormatOptions, error)

DefaultDescribeFormatOptions returns default options for formatting the output.

type DescribeOptions struct {

MaxCandidatesTags [uint](/builtin#uint) 


Strategy [DescribeOptionsStrategy](#DescribeOptionsStrategy) 


Pattern [string](/builtin#string)


OnlyFollowFirstParent [bool](/builtin#bool)


ShowCommitOidAsFallback [bool](/builtin#bool)

}

DescribeOptions represents the describe operation configuration.

You can use DefaultDescribeOptions() to get default options.

func DefaultDescribeOptions() (DescribeOptions, error)

DefaultDescribeOptions returns default options for the describe operation.

type DescribeOptionsStrategy uint

DescribeOptionsStrategy behaves like the --tags and --all options to git-describe, namely they say to look for any reference in either refs/tags/ or refs/ respectively.

By default it only shows annotated tags.

Describe strategy options.

type DescribeResult struct {

}

DescribeResult represents the output from the 'git_describe_commit' and 'git_describe_workdir' functions in libgit2.

Use Format() to get a string out of it.

Format prints the DescribeResult as a string.

func (result *DescribeResult) Free()

Free cleans up the C reference.

func DiffFromBuffer(buffer []byte, repo Repository) (Diff, error)

DiffFromBuffer reads the contents of a git patch file into a Diff object.

The diff object produced is similar to the one that would be produced if you actually produced it computationally by comparing two trees, however there may be subtle differences. For example, a patch file likely contains abbreviated object IDs, so the object IDs in a git_diff_delta produced by this function will also be abbreviated.

This function will only read patch files created by a git implementation, it will not read unified diffs produced by the diff program, nor any other types of patch files.

func (diff *Diff) FindSimilar(opts *DiffFindOptions) error

func (diff *Diff) ForEach(cbFile DiffForEachFileCallback, detail DiffDetail) error

deprecated: You should use `Diff.Delta()` instead.

func (diff Diff) Patch(deltaIndex int) (Patch, error)

func (diff Diff) Stats() (DiffStats, error)

type DiffDelta struct { Status Delta Flags DiffFlag Similarity uint16 OldFile DiffFile NewFile DiffFile }

const ( DiffDetailFiles DiffDetail = iota DiffDetailHunks DiffDetailLines )

type DiffFindOptions struct { Flags DiffFindOptionsFlag RenameThreshold uint16 CopyThreshold uint16 RenameFromRewriteThreshold uint16 BreakRewriteThreshold uint16 RenameLimit uint }

TODO implement git_diff_similarity_metric

func DefaultDiffFindOptions() (DiffFindOptions, error)

type DiffFindOptionsFlag int

type DiffForEachHunkCallback func(DiffHunk) (DiffForEachLineCallback, error)

type DiffForEachLineCallback func(DiffLine) error

type DiffHunk struct { OldStart int OldLines int NewStart int NewLines int }

type DiffLine struct { Origin DiffLineType OldLineno int NewLineno int NumLines int Content string }

type DiffNotifyCallback func(diffSoFar *Diff, deltaToAdd DiffDelta, matchedPathspec string) error

func DefaultDiffOptions() (DiffOptions, error)

type DiffStats struct {

}

func (stats *DiffStats) Deletions() int

func (stats *DiffStats) FilesChanged() int

func (stats *DiffStats) Insertions() int

Features returns a bit-flag of Feature values indicating which features the loaded libgit2 library has.

type FetchOptions struct {

RemoteCallbacks [RemoteCallbacks](#RemoteCallbacks)

Prune [FetchPrune](#FetchPrune)


UpdateFetchhead [bool](/builtin#bool)


DownloadTags [DownloadTags](#DownloadTags)

Headers [][string](/builtin#string)


ProxyOptions [ProxyOptions](#ProxyOptions)

}

type GitError struct { Message string Class ErrorClass Code ErrorCode }

type HandleList

func (*HandleList) Clear

func (v *HandleList) Clear()

Clear stops tracking all the managed pointers.

func (*HandleList) Get

Get retrieves the pointer from the given handle

func (*HandleList) Track

Track adds the given pointer to the list of pointers to track and returns a pointer value which can be passed to C as an opaque pointer.

func (*HandleList) Untrack

Untrack stops tracking the pointer given by the handle

Server host key information. A bitmask containing the available fields. Check for combinations of: HostkeyMD5, HostkeySHA1, HostkeySHA256, HostkeyRaw.

HostkeyKind is a bitmask of the available hashes in HostkeyCertificate.

NewIndex allocates a new index. It won't be associated with any file on the filesystem or repository

OpenIndex creates a new index at the given path. If the file does not exist it will be created when Write() is called.

Add adds or replaces the given entry to the index, making a copy of the data

func (v *Index) AddConflict(ancestor *IndexEntry, our *IndexEntry, their *IndexEntry) error

func (v *Index) AddFromBuffer(entry *IndexEntry, buffer []byte) error

AddFromBuffer adds or replaces an index entry from a buffer in memory

func (v *Index) CleanupConflicts()

FIXME: this might return an error

Clear clears the index object in memory; changes must be explicitly written to disk for them to take effect persistently

func (v Index) ConflictIterator() (IndexConflictIterator, error)

func (v *Index) EntryCount() uint

deprecated: You should use `Index.Conflict()` instead.

func (v *Index) HasConflicts() bool

Path returns the index' path on disk or an empty string if it exists only in memory.

func (v *Index) ReadTree(tree *Tree) error

ReadTree replaces the contents of the index with those of the given tree

RemoveDirectory removes all entries from the index under a given directory.

func (v Index) WriteTree() (Oid, error)

func (v *Index) WriteTreeTo(repo Repository) (Oid, error)

IndexAddOption is a set of flags for APIs that add files matching pathspec.

type IndexAddOpts = IndexAddOption

Deprecated: IndexAddOpts is a deprecated alias of IndexAddOption.

type IndexConflict struct { Ancestor *IndexEntry Our *IndexEntry Their *IndexEntry }

type IndexConflictIterator struct {

}

func (v *IndexConflictIterator) Free()

func (v *IndexConflictIterator) Index() *Index

type IndexStageOpts = IndexStageState

Deprecated: IndexStageOpts is a deprecated alias of IndexStageState.

IndexStageState indicates the state of the git index.

type IndexTime struct { Seconds int32 Nanoseconds uint32 }

Indexer can post-process packfiles and create an .idx file for efficient lookup.

func NewIndexer(packfilePath string, odb *Odb, callback TransferProgressCallback) (indexer *Indexer, err error)

NewIndexer creates a new indexer instance.

func (indexer Indexer) Commit() (Oid, error)

Commit finalizes the pack and index. It resolves any pending deltas and writes out the index file.

It also returns the packfile's hash. A packfile's name is derived from the sorted hashing of all object names.

func (indexer *Indexer) Free()

Free frees the indexer and its resources.

Write adds data to the indexer.

Mempack is a custom ODB backend that permits packing object in-memory.

func NewMempack(odb *Odb) (mempack *Mempack, err error)

NewMempack creates a new mempack instance and registers it to the ODB.

Dump dumps all the queued in-memory writes to a packfile.

It is the caller's responsibility to ensure that the generated packfile is available to the repository (e.g. by writing it to disk, or doing something crazy like distributing it across several copies of the repository over a network).

Once the generated packfile is available to the repository, call Mempack.Reset to cleanup the memory store.

Calling Mempack.Reset before the packfile has been written to disk will result in an inconsistent repository (the objects in the memory store won't be accessible).

func (mempack *Mempack) Reset() error

Reset resets the memory packer by clearing all the queued objects.

This assumes that Mempack.Dump has been called before to store all the queued objects into a single packfile.

func MergeFile(ancestor MergeFileInput, ours MergeFileInput, theirs MergeFileInput, options MergeFileOptions) (MergeFileResult, error)

func (r *MergeFileResult) Free()

type MergeOptions struct { TreeFlags MergeTreeFlag

RenameThreshold [uint](/builtin#uint)
TargetLimit     [uint](/builtin#uint)
RecursionLimit  [uint](/builtin#uint)
FileFavor       [MergeFileFavor](#MergeFileFavor)

}

func DefaultMergeOptions() (MergeOptions, error)

MessageEncoding is the encoding of commit messages.

const (

MessageEncodingUTF8 [MessageEncoding](#MessageEncoding) = "UTF-8"

)

Note

func (n *Note) Author() *Signature

Author returns the signature of the note author

func (n *Note) Committer() *Signature

Committer returns the signature of the note committer

Free frees a git_note object

Id returns the note object's id

Message returns the note message

type NoteCollection struct {

}

This object represents the possible operations which can be performed on the collection of notes for a repository.

Create adds a note for an object

DefaultRef returns the default notes reference for a repository

Read reads the note for an object

Remove removes the note for an object

type NoteIterator struct {

}

NoteIterator

func (v *NoteIterator) Free()

Free frees the note interator

func (it *NoteIterator) Next() (noteId, annotatedId *Oid, err error)

Next returns the current item (note id & annotated id) and advances the iterator internally to the next item

func (o Object) AsBlob() (Blob, error)

func (o Object) AsCommit() (Commit, error)

func (o Object) AsTree() (Tree, error)

func (o *Object) Id() *Oid

func (o *Object) Owner() *Repository

Owner returns a weak reference to the repository which owns this object. This won't keep the underlying repository alive, but it should still be Freed.

Peel recursively peels an object until an object of the specified type is met.

If the query cannot be satisfied due to the object model, ErrorCodeInvalidSpec will be returned (e.g. trying to peel a blob to a tree).

If you pass ObjectAny as the target type, then the object will be peeled until the type changes. A tag will be peeled until the referenced object is no longer a tag, and a commit will be peeled to a tree. Any other object type will return ErrorCodeInvalidSpec.

If peeling a tag we discover an object which cannot be peeled to the target type due to the object model, an error will be returned.

func (o *Object) Type() ObjectType

type Objecter interface { AsObject() *Object }

Objecter lets us accept any kind of Git object in functions.

func NewOdb() (odb *Odb, err error)

func (v *Odb) AddAlternate(backend *OdbBackend, priority int) (err error)

func (v *Odb) AddBackend(backend *OdbBackend, priority int) (err error)

func (v *Odb) Exists(oid *Oid) bool

func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error)

Hash determines the object-ID (sha1) of a data buffer.

func (v *Odb) NewReadStream(id Oid) (OdbReadStream, error)

NewReadStream opens a read stream from the ODB. Reading from it will give you the contents of the object.

func (v Odb) NewWritePack(callback TransferProgressCallback) (OdbWritepack, error)

NewWritePack opens a stream for writing a pack file to the ODB. If the ODB layer understands pack files, then the given packfile will likely be streamed directly to disk (and a corresponding index created). If the ODB layer does not understand pack files, the objects will be stored in whatever format the ODB layer uses.

NewWriteStream opens a write stream to the ODB, which allows you to create a new object in the database. The size and type must be known in advance

func (v *Odb) Read(oid *Oid) (obj *OdbObject, err error)

func (odb *Odb) Refresh() error

func (v *Odb) Write(data []byte, otype ObjectType) (oid *Oid, err error)

func (odb *Odb) WriteMultiPackIndex() error

type OdbBackend struct {

}

NewOdbBackendLoose creates a backend for loose objects.

func NewOdbBackendOnePack(packfileIndexPath string) (backend *OdbBackend, err error)

func (v *OdbBackend) Free()

type OdbForEachCallback func(id *Oid) error

type OdbObject struct {

}

func (object *OdbObject) Data() (data []byte)

Data returns a slice pointing to the unmanaged object memory. You must make sure the object is referenced for at least as long as the slice is used.

func (v *OdbObject) Free()

func (object *OdbObject) Id() (oid *Oid)

func (object *OdbObject) Type() ObjectType

type OdbReadStream struct { Size uint64 Type ObjectType

}

Close is a dummy function in order to implement the Closer and ReadCloser interfaces

func (stream *OdbReadStream) Free()

Read reads from the stream

type OdbWriteStream struct { Id Oid

}

Close signals that all the data has been written and stores the resulting object id in the stream's Id field.

func (stream *OdbWriteStream) Free()

Write writes to the stream

type OdbWritepack struct {

}

OdbWritepack is a stream to write a packfile to the ODB.

func (writepack *OdbWritepack) Commit() error

func (writepack *OdbWritepack) Free()

Oid represents the id for a Git object.

func NewOidFromBytes(b []byte) *Oid

func (oid *Oid) Cmp(oid2 *Oid) int

func (oid *Oid) Copy() *Oid

func (oid *Oid) Equal(oid2 *Oid) bool

func (oid *Oid) IsZero() bool

type Packbuilder struct {

}

ForEach repeatedly calls the callback with new packfile data until there is no more data or the callback returns an error

func (pb *Packbuilder) Free()

func (pb *Packbuilder) InsertCommit(id *Oid) error

func (pb *Packbuilder) InsertTree(id *Oid) error

func (pb *Packbuilder) InsertWalk(walk *RevWalk) error

type PackbuilderForeachCallback func([]byte) error

type ProxyOptions struct {

Type [ProxyType](#ProxyType)


Url [string](/builtin#string)

}

type PushOptions struct {

RemoteCallbacks [RemoteCallbacks](#RemoteCallbacks)

PbParallelism [uint](/builtin#uint)

Headers [][string](/builtin#string)


ProxyOptions [ProxyOptions](#ProxyOptions)

}

type PushTransferProgressCallback func(current, total uint32, bytes uint) error

type PushUpdateReferenceCallback func(refname, status string) error

Rebase is the struct representing a Rebase object.

func (rebase *Rebase) Abort() error

Abort aborts a rebase that is currently in progress, resetting the repository and working directory to their state before rebase began.

func (rebase *Rebase) Commit(ID *Oid, author, committer *Signature, message string) error

Commit commits the current patch. You must have resolved any conflicts that were introduced during the patch application from the Next() invocation.

func (rebase *Rebase) CurrentOperationIndex() (uint, error)

CurrentOperationIndex gets the index of the rebase operation that is currently being applied. There is also an error returned for API compatibility.

func (rebase *Rebase) Finish() error

Finish finishes a rebase that is currently in progress once all patches have been applied.

Free frees the Rebase object.

func (rebase Rebase) InmemoryIndex() (Index, error)

InmemoryIndex gets the index produced by the last operation, which is the result of `Next()` and which will be committed by the next invocation of `Commit()`. This is useful for resolving conflicts in an in-memory rebase before committing them.

This is only applicable for in-memory rebases; for rebases within a working directory, the changes were applied to the repository's index.

Next performs the next rebase operation and returns the information about it. If the operation is one that applies a patch (which is any operation except RebaseOperationExec) then the patch will be applied and the index and working directory will be updated with the changes. If there are conflicts, you will need to address those before committing the changes.

func (rebase *Rebase) OperationAt(index uint) *RebaseOperation

OperationAt gets the rebase operation specified by the given index.

func (rebase *Rebase) OperationCount() uint

OperationCount gets the count of rebase operations that are to be applied.

type RebaseOperation struct { Type RebaseOperationType Id *Oid Exec string }

RebaseOperation describes a single instruction/operation to be performed during the rebase.

type RebaseOperationType uint

RebaseOperationType is the type of rebase operation

type RebaseOptions struct { Quiet int InMemory int RewriteNotesRef string MergeOptions MergeOptions CheckoutOptions CheckoutOptions

CommitCreateCallback [CommitCreateCallback](#CommitCreateCallback)


CommitSigningCallback [CommitSigningCallback](#CommitSigningCallback)

}

RebaseOptions are used to tell the rebase machinery how to operate.

func DefaultRebaseOptions() (RebaseOptions, error)

DefaultRebaseOptions returns a RebaseOptions with default values.

func (v *Refdb) SetBackend(backend *RefdbBackend) (err error)

type RefdbBackend struct {

}

func (v *RefdbBackend) Free()

type Reference struct {

}

func (r *Reference) Branch() *Branch

func (v *Reference) Cmp(ref2 *Reference) int

Cmp compares v to ref2. It returns 0 on equality, otherwise a stable sorting.

func (v *Reference) Free()

func (v *Reference) IsBranch() bool

IsNote checks if the reference is a note.

func (v *Reference) IsRemote() bool

Name returns the full name of v.

func (v *Reference) Owner() *Repository

Owner returns a weak reference to the repository which owns this reference. This won't keep the underlying repository alive, but it should still be Freed.

func (*Reference) Shorthand

Shorthand returns a "human-readable" short reference name.

func (v *Reference) Target() *Oid

func (v *Reference) Type() ReferenceType

type ReferenceCollection struct {

}

Dwim looks up a reference by DWIMing its short name

EnsureLog ensures that there is a reflog for the given reference name and creates an empty one if necessary.

HasLog returns whether there is a reflog for the given reference name

type ReferenceFormat uint

type ReferenceIterator struct {

}

func (v *ReferenceIterator) Free()

Free the reference iterator

func (i *ReferenceIterator) Names() *ReferenceNameIterator

Next retrieves the next reference. If the iterationis over, the returned error code is git.ErrorCodeIterOver

type ReferenceNameIterator struct { *ReferenceIterator

}

NextName retrieves the next reference name. If the iteration is over, the returned error code is git.ErrorCodeIterOver

ParseRefspec parses a given refspec string

func (s *Refspec) Direction() ConnectDirection

Direction returns the refspec's direction

Dst returns the refspec's destination specifier

SrcMatches checks if a refspec's destination descriptor matches a reference

Force returns the refspec's force-update setting

Free releases a refspec object which has been created by ParseRefspec

Rtransform converts a target reference to its source reference following the refspec's rules

Src returns the refspec's source specifier

SrcMatches checks if a refspec's source descriptor matches a reference

String returns the refspec's string representation

Transform a reference to its target following the refspec's rules

type RegisteredSmartTransport struct {

}

RegisteredSmartTransport represents a transport that has been registered.

NewRegisteredSmartTransport adds a custom transport definition, to be used in addition to the built-in set of transports that come with libgit2.

RegisterManagedHTTPTransport registers a Go-native implementation of an HTTP/S transport that doesn't rely on any system libraries (e.g. libopenssl/libmbedtls).

If Shutdown or ReInit are called, make sure that the smart transports are freed before it.

RegisterManagedSSHTransport registers a Go-native implementation of an SSH transport that doesn't rely on any system libraries (e.g. libssh2).

If Shutdown or ReInit are called, make sure that the smart transports are freed before it.

Free releases all resources used by the RegisteredSmartTransport and unregisters the custom transport definition referenced by it.

func (o *Remote) Connect(direction ConnectDirection, callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string) error

Connect opens a connection to a remote.

The transport is selected based on the URL. The direction argument is due to a limitation of the git protocol (over TCP or SSH) which starts up a specific binary which can only do the one or the other.

'headers' are extra HTTP headers to use in this connection.

func (o *Remote) ConnectFetch(callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string) error

func (o *Remote) ConnectPush(callbacks *RemoteCallbacks, proxyOpts *ProxyOptions, headers []string) error

func (o *Remote) Disconnect()

Fetch performs a fetch operation. refspecs specifies which refspecs to use for this fetch, use an empty list to use the refspecs from the configuration; msg specifies what to use for the reflog entries. Leave "" to use defaults.

Free releases the resources of the Remote.

func (o *Remote) PruneRefs() bool

func (o *Remote) RefspecCount() uint

CreateWithOptions Creates a repository object with extended options.

func (c *RemoteCollection) Free()

type RemoteCompletion uint

type RemoteConnectOptions struct {

ProxyOptions [ProxyOptions](#ProxyOptions)

}

type RemoteCreateCallback func(repo Repository, name, url string) (Remote, error)

RemoteCreateOptions contains options for creating a remote

func DefaultRemoteCreateOptions() (*RemoteCreateOptions, error)

DefaultApplyOptions returns default options for remote create

type RemoteCreateOptionsFlag uint

RemoteCreateOptionsFlag is Remote creation options flags

type RemoteHead struct { Id *Oid Name string }

type Repository struct {

Remotes [RemoteCollection](#RemoteCollection)


Submodules [SubmoduleCollection](#SubmoduleCollection)


References [ReferenceCollection](#ReferenceCollection)


Notes [NoteCollection](#NoteCollection)


Tags [TagsCollection](#TagsCollection)


Stashes [StashCollection](#StashCollection)

}

Repository

func NewRepositoryWrapOdb(odb *Odb) (repo *Repository, err error)

func (repo *Repository) AheadBehind(local, upstream *Oid) (ahead, behind int, err error)

func (r *Repository) AnnotatedCommitFromRef(ref Reference) (AnnotatedCommit, error)

func (v *Repository) ApplyDiff(diff *Diff, location ApplyLocation, opts *ApplyOptions) error

ApplyDiff appllies a Diff to the given repository, making changes directly in the working directory, the index, or both.

func (v *Repository) ApplyToTree(diff *Diff, tree *Tree, opts ApplyOptions) (Index, error)

ApplyToTree applies a Diff to a Tree and returns the resulting image as an Index.

Updates files in the index and the working tree to match the content of the commit pointed at by HEAD. opts may be nil.

func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOptions) error

Updates files in the working tree to match the content of the given index. If index is nil, the repository's index will be used. opts may be nil.

func (v *Repository) CheckoutTree(tree *Tree, opts *CheckoutOptions) error

func (v *Repository) Cherrypick(commit *Commit, opts CherrypickOptions) error

func (r *Repository) CherrypickCommit(pick, our Commit, opts CherrypickOptions) (Index, error)

func (r *Repository) ClearGitIgnoreRules() error

func (v *Repository) ClearInternalIgnoreRules() error

func (repo Repository) CreateBlobFromBuffer(data []byte) (Oid, error)

func (v *Repository) CreateCommit( refname string, author, committer Signature, message string, tree Tree, parents ...Commit) (Oid, error)

func (v *Repository) CreateCommitBuffer( author, committer *Signature, messageEncoding MessageEncoding, message string, tree Tree, parents ...Commit, ) ([]byte, error)

CreateCommitBuffer creates a commit and write it into a buffer.

func (v *Repository) CreateCommitFromIds( refname string, author, committer Signature, message string, tree Oid, parents ...Oid) (Oid, error)

func (v Repository) CreateCommitWithSignature( commitContent, signature, signatureField string, ) (Oid, error)

CreateCommitWithSignature creates a commit object from the given contents and signature.

func (repo Repository) DefaultSignature() (Signature, error)

func (repo *Repository) DescendantOf(commit, ancestor *Oid) (bool, error)

func (repo *Repository) DescribeWorkdir(opts DescribeOptions) (DescribeResult, error)

DescribeWorkdir describes the working tree. It means describe HEAD and appends (-dirty by default) if the working tree is dirty.

func (v *Repository) DiffIndexToWorkdir(index *Index, opts DiffOptions) (Diff, error)

func (v *Repository) DiffTreeToIndex(oldTree *Tree, index *Index, opts DiffOptions) (Diff, error)

func (v *Repository) DiffTreeToTree(oldTree, newTree *Tree, opts DiffOptions) (Diff, error)

func (v *Repository) DiffTreeToWorkdir(oldTree *Tree, opts DiffOptions) (Diff, error)

func (v *Repository) DiffTreeToWorkdirWithIndex(oldTree *Tree, opts DiffOptions) (Diff, error)

func (v *Repository) Free()

func (r *Repository) InitRebase(branch *AnnotatedCommit, upstream *AnnotatedCommit, onto *AnnotatedCommit, opts RebaseOptions) (Rebase, error)

InitRebase initializes a rebase operation to rebase the changes in branch relative to upstream onto another branch.

func (repo *Repository) IsBare() bool

func (r *Repository) LookupAnnotatedCommit(oid Oid) (AnnotatedCommit, error)

func (v *Repository) LookupBlob(id Oid) (Blob, error)

func (v *Repository) LookupCommit(id Oid) (Commit, error)

LookupPrefix looks up an object by its OID given a prefix of its identifier.

func (v *Repository) LookupPrefixBlob(id Oid, prefix uint) (Blob, error)

LookupPrefixBlob looks up a blob by its OID given a prefix of its identifier.

func (v *Repository) LookupPrefixCommit(id Oid, prefix uint) (Commit, error)

LookupPrefixCommit looks up a commit by its OID given a prefix of its identifier.

func (v *Repository) LookupPrefixTag(id Oid, prefix uint) (Tag, error)

LookupPrefixTag looks up a tag by its OID given a prefix of its identifier.

func (v *Repository) LookupPrefixTree(id Oid, prefix uint) (Tree, error)

LookupPrefixTree looks up a tree by its OID given a prefix of its identifier.

func (v *Repository) LookupTag(id Oid) (Tag, error)

func (v *Repository) LookupTree(id Oid) (Tree, error)

func (r Repository) Merge(theirHeads []AnnotatedCommit, mergeOptions *MergeOptions, checkoutOptions *CheckoutOptions) error

func (r Repository) MergeAnalysis(theirHeads []AnnotatedCommit) (MergeAnalysis, MergePreference, error)

MergeAnalysis returns the possible actions which could be taken by a 'git-merge' command. There may be multiple answers, so the first return value is a bitmask of MergeAnalysis values.

func (r *Repository) MergeBase(one *Oid, two Oid) (Oid, error)

func (r Repository) MergeBaseMany(oids []Oid) (*Oid, error)

MergeBaseMany finds a merge base given a list of commits.

func (r Repository) MergeBaseOctopus(oids []Oid) (*Oid, error)

MergeBaseOctopus finds a merge base in preparation for an octopus merge.

func (r *Repository) MergeBases(one, two Oid) ([]Oid, error)

MergeBases retrieves the list of merge bases between two commits.

If none are found, an empty slice is returned and the error is set approprately

func (r Repository) MergeBasesMany(oids []Oid) ([]*Oid, error)

MergeBasesMany finds all merge bases given a list of commits.

func (r *Repository) MergeCommits(ours *Commit, theirs *Commit, options MergeOptions) (Index, error)

func (r *Repository) MergeTrees(ancestor *Tree, ours *Tree, theirs *Tree, options MergeOptions) (Index, error)

Message retrieves git's prepared message. Operations such as git revert/cherry-pick/merge with the -n option stop just short of creating a commit with the changes and save their prepared message in .git/MERGE_MSG so the next git-commit execution can present it to the user for them to amend if they wish.

Use this function to get the contents of this file. Don't forget to remove the file after you create the commit.

func (repo Repository) NewBranchIterator(flags BranchType) (BranchIterator, error)

NewNoteIterator creates a new iterator for notes

func (repo Repository) NewPackbuilder() (Packbuilder, error)

func (v *Repository) NewRefdb() (refdb *Refdb, err error)

func (repo Repository) NewReferenceIterator() (ReferenceIterator, error)

NewReferenceIterator creates a new iterator over reference names

NewReferenceIteratorGlob creates an iterator over reference names that match the speicified glob. The glob is of the usual fnmatch type.

func (repo Repository) NewReferenceNameIterator() (ReferenceNameIterator, error)

NewReferenceIterator creates a new branch iterator over reference names

func (v *Repository) Odb() (odb *Odb, err error)

func (r *Repository) OpenRebase(opts RebaseOptions) (Rebase, error)

OpenRebase opens an existing rebase that was previously started by either an invocation of InitRebase or by another client.

func (v *Repository) PatchFromBuffers(oldPath, newPath string, oldBuf, newBuf []byte, opts DiffOptions) (Patch, error)

func (repo *Repository) ReachableFromAny(commit Oid, descendants []Oid) (bool, error)

ReachableFromAny returns whether a commit is reachable from any of a list of commits by following parent edges.

func (r *Repository) RemoveMessage() error

RemoveMessage removes git's prepared message.

func (r *Repository) ResetDefaultToCommit(commit *Commit, pathspecs []string) error

func (r *Repository) ResetToCommit(commit *Commit, resetType ResetType, opts *CheckoutOptions) error

func (r *Repository) Revert(commit *Commit, revertOptions *RevertOptions) error

Revert the provided commit leaving the index updated with the results of the revert

func (r *Repository) RevertCommit(revertCommit *Commit, ourCommit *Commit, mainline uint, mergeOptions MergeOptions) (Index, error)

RevertCommit reverts the provided commit against "ourCommit" The returned index contains the result of the revert and should be freed

SetConfig sets the configuration file for this repository.

This configuration file will be used for all configuration queries involving this repository.

func (v *Repository) SetHeadDetached(id *Oid) error

func (v *Repository) SetRefdb(refdb *Refdb)

func (r *Repository) State() RepositoryState

func (r *Repository) StateCleanup() error

func (v *Repository) TreeBuilderFromTree(tree Tree) (TreeBuilder, error)

type RepositoryOpenFlag int

func (v *RevWalk) HideHead() (err error)

func (v *RevWalk) Iterate(fun RevWalkIterator) (err error)

func (v *RevWalk) Next(id *Oid) (err error)

func (v *RevWalk) PushHead() (err error)

func (v *RevWalk) Reset()

func (v *RevWalk) SimplifyFirstParent()

func (v *RevWalk) Sorting(sm SortType)

type RevWalkIterator func(commit *Commit) bool

type RevertOptions struct { Mainline uint MergeOptions MergeOptions CheckoutOptions CheckoutOptions }

RevertOptions contains options for performing a revert

func DefaultRevertOptions() (RevertOptions, error)

DefaultRevertOptions initialises a RevertOptions struct with default values

func (rs *Revspec) Flags() RevparseFlag

func (rs *Revspec) From() *Object

func (rs *Revspec) To() *Object

func (v *Signature) Offset() int

Offset returns the time zone offset of v.When in minutes, which is what git wants.

type SmartServiceAction int

SmartServiceAction is an action that the smart transport can ask a subtransport to perform.

SmartSubtransport is the interface for custom subtransports which carry data for the smart transport.

type SmartSubtransportCallback func(remote *Remote, transport *Transport) (SmartSubtransport, error)

SmartSubtransportCallback is a function which creates a new subtransport for the smart transport.

SmartSubtransportStream is the interface for streams used by the smart transport to read and write data from a subtransport.

StashApplyFlag are flags that affect the stash apply operation.

type StashApplyOptions struct { Flags StashApplyFlag CheckoutOptions CheckoutOptions
ProgressCallback StashApplyProgressCallback }

StashApplyOptions represents options to control the apply operation.

func DefaultStashApplyOptions() (StashApplyOptions, error)

DefaultStashApplyOptions initializes the structure with default values.

type StashApplyProgress int

StashApplyProgress are flags describing the progress of the apply operation.

type StashApplyProgressCallback func(progress StashApplyProgress) error

StashApplyProgressCallback is the apply operation notification callback.

StashCallback is called per entry when interating over all the stashed states.

'index' is the position of the current stash in the stash list, 'message' is the message used when creating the stash and 'id' is the commit id of the stash.

type StashCollection struct {

}

StashCollection represents the possible operations that can be performed on the collection of stashes for a repository.

Apply applies a single stashed state from the stash list.

If local changes in the working directory conflict with changes in the stash then ErrorCodeConflict will be returned. In this case, the index will always remain unmodified and all files in the working directory will remain unmodified. However, if you are restoring untracked files or ignored files and there is a conflict when applying the modified files, then those files will remain in the working directory.

If passing the StashApplyReinstateIndex flag and there would be conflicts when reinstating the index, the function will return ErrorCodeConflict and both the working directory and index will be left unmodified.

Note that a minimum checkout strategy of 'CheckoutSafe' is implied.

'index' is the position within the stash list. 0 points to the most recent stashed state.

Returns error code ErrorCodeNotFound if there's no stashed state for the given index, error code ErrorCodeConflict if local changes in the working directory conflict with changes in the stash, the user returned error from the StashApplyProgressCallback, if any, or other error code.

Error codes can be interogated with IsErrorCode(err, ErrorCodeNotFound).

Drop removes a single stashed state from the stash list.

'index' is the position within the stash list. 0 points to the most recent stashed state.

Returns error code ErrorCodeNotFound if there's no stashed state for the given index.

Foreach loops over all the stashed states and calls the callback for each one.

If callback returns an error, this will stop looping.

Pop applies a single stashed state from the stash list and removes it from the list if successful.

'index' is the position within the stash list. 0 points to the most recent stashed state.

'opts' controls how stashes are applied.

Returns error code ErrorCodeNotFound if there's no stashed state for the given index.

Save saves the local modifications to a new stash.

Stasher is the identity of the person performing the stashing. Message is the optional description along with the stashed state. Flags control the stashing process and are given as bitwise OR.

StashFlag are flags that affect the stash save operation.

type StatusEntry struct { Status Status HeadToIndex DiffDelta IndexToWorkdir DiffDelta }

type StatusList struct {

}

func (statusList *StatusList) EntryCount() (int, error)

func (statusList *StatusList) Free()

type StatusOptions struct { Show StatusShow Flags StatusOpt Pathspec []string }

type Submodule struct {

}

Submodule

func (sub *Submodule) FetchRecurseSubmodules() SubmoduleRecurse

func (sub *Submodule) FinalizeAdd() error

func (sub *Submodule) Free()

func (sub *Submodule) HeadId() *Oid

func (sub *Submodule) Ignore() SubmoduleIgnore

func (sub *Submodule) IndexId() *Oid

func (sub *Submodule) UpdateStrategy() SubmoduleUpdate

func (sub *Submodule) WdId() *Oid

SubmoduleCallback is a function that is called for every submodule found in SubmoduleCollection.Foreach.

type SubmoduleCbk = SubmoduleCallback

Deprecated: SubmoduleCbk is a deprecated alias of SubmoduleCallback.

type SubmoduleCollection struct {

}

type SubmoduleRecurse int

type SubmoduleUpdateOptions struct { CheckoutOptions CheckoutOptions FetchOptions FetchOptions }

SubmoduleUpdateOptions

type Tag struct { Object

}

Tag

func (t *Tag) AsObject() *Object

func (t *Tag) Tagger() *Signature

func (t *Tag) Target() *Object

func (t *Tag) TargetId() *Oid

func (t *Tag) TargetType() ObjectType

TagForeachCallback is called for each tag in the repository.

The name is the full ref name eg: "refs/tags/v1.0.0".

Note that the callback is called for lightweight tags as well, so repo.LookupTag() will return an error for these tags. Use repo.References.Lookup() instead.

type TagsCollection struct {

}

CreateLightweight creates a new lightweight tag pointing to an object and returns the id of the target object.

The name of the tag is validated for consistency (see git_tag_create() for the ruleshttps://libgit2.github.com/libgit2/#HEAD/group/tag/git_tag_create) and should not conflict with an already existing tag name.

If force is true and a reference already exists with the given name, it'll be replaced.

The created tag is a simple reference and can be queried using repo.References.Lookup("refs/tags/"). The name of the tag (eg "v1.0.0") is queried with ref.Shorthand().

Foreach calls the callback for each tag in the repository.

List returns the names of all the tags in the repository, eg: ["v1.0.1", "v2.0.0"].

Trailer represents a single git message trailer.

MessageTrailers parses trailers out of a message, returning a slice of Trailer structs. Trailers are key/value pairs in the last paragraph of a message, not including any patches or conflicts that may be present.

type TransferProgress struct { TotalObjects uint IndexedObjects uint ReceivedObjects uint LocalObjects uint TotalDeltas uint ReceivedBytes uint }

type TransferProgressCallback func(stats TransferProgress) error

type Transport struct {

}

Transport encapsulates a way to communicate with a Remote.

SmartCertificateCheck calls the certificate check for this transport.

SmartCredentials calls the credentials callback for this transport.

func (t Transport) SmartRemoteConnectOptions() (RemoteConnectOptions, error)

SmartRemoteConnectOptions gets a copy of the proxy options for this transport.

type Tree struct { Object

}

func (t *Tree) AsObject() *Object

func (t *Tree) EntryById(id *Oid) *TreeEntry

EntryById performs a lookup for a tree entry with the given SHA value.

It returns a *TreeEntry that is owned by the Tree. You don't have to free it, but you must not use it after the Tree is freed.

Warning: this must examine every entry in the tree, so it is not fast.

func (t *Tree) EntryByIndex(index uint64) *TreeEntry

func (t *Tree) EntryByName(filename string) *TreeEntry

EntryByPath looks up an entry by its full path, recursing into deeper trees if necessary (i.e. if there are slashes in the path)

Walk traverses the entries in a tree and its subtrees in pre order.

The entries will be traversed in the pre order, children subtrees will be automatically loaded as required, and the callback will be called once per entry with the current (relative) root for the entry and the entry data itself.

If the callback returns TreeWalkSkip, the passed entry will be skipped on the traversal. Any other non-nil error stops the walk.

type TreeBuilder struct {

}

func (v *TreeBuilder) Free()

type TreeEntry struct { Name string Id *Oid Type ObjectType Filemode Filemode }

type UpdateTipsCallback func(refname string, a *Oid, b *Oid) error