plumbing
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
package plumbing implement the core interfaces and structs used by go-git
Index¶
- Variables
- func HashesSort(a []Hash)
- func IsHash(s string) bool
- type DeltaObject
- type EncodedObject
- type Hash
- type HashSlice
- type Hasher
- type MemoryObject
- func (o *MemoryObject) Close() error
- func (o *MemoryObject) Hash() Hash
- func (o *MemoryObject) Reader() (io.ReadCloser, error)
- func (o *MemoryObject) SetSize(s int64)
- func (o *MemoryObject) SetType(t ObjectType)
- func (o *MemoryObject) Size() int64
- func (o *MemoryObject) Type() ObjectType
- func (o *MemoryObject) Write(p []byte) (n int, err error)
- func (o *MemoryObject) Writer() (io.WriteCloser, error)
- type ObjectType
- type PermanentError
- type Reference
- type ReferenceName
- type ReferenceType
- type Revision
- type UnexpectedError
Constants¶
This section is empty.
Variables¶
var (ErrObjectNotFound =errors.New("object not found")// ErrInvalidType is returned when an invalid object type is provided.ErrInvalidType =errors.New("invalid object type"))
var (ErrReferenceNotFound =errors.New("reference not found")// ErrInvalidReferenceName is returned when a reference name is invalid.ErrInvalidReferenceName =errors.New("invalid reference name"))
var RefRevParseRules = []string{"%s","refs/%s","refs/tags/%s","refs/heads/%s","refs/remotes/%s","refs/remotes/%s/HEAD",}RefRevParseRules are a set of rules to parse references into short names, or expand into a full reference.These are the same rules as used by git in shorten_unambiguous_ref and expand_ref.See:https://github.com/git/git/blob/e0aaa1b6532cfce93d87af9bc813fb2e7a7ce9d7/refs.c#L417
Functions¶
Types¶
typeDeltaObject¶
type DeltaObject interface {EncodedObject// BaseHash returns the hash of the object used as base for this delta.BaseHash()Hash// ActualHash returns the hash of the object after applying the delta.ActualHash()Hash// Size returns the size of the object after applying the delta.ActualSize()int64}DeltaObject is an EncodedObject representing a delta.
typeEncodedObject¶
type EncodedObject interface {Hash()HashType()ObjectTypeSetType(ObjectType)Size()int64SetSize(int64)Reader() (io.ReadCloser,error)Writer() (io.WriteCloser,error)}Object is a generic representation of any git object
typeHash¶
Hash SHA1 hashed content
var ZeroHashHashZeroHash is Hash with value zero
funcComputeHash¶
func ComputeHash(tObjectType, content []byte)Hash
ComputeHash compute the hash for a given ObjectType and content
typeHashSlice¶
type HashSlice []Hash
HashSlice attaches the methods of sort.Interface to []Hash, sorting inincreasing order.
typeMemoryObject¶
type MemoryObject struct {// contains filtered or unexported fields}MemoryObject on memory Object implementation
func (*MemoryObject)Close¶
func (o *MemoryObject) Close()error
Close releases any resources consumed by the object when it is acting as aObjectWriter.
func (*MemoryObject)Hash¶
func (o *MemoryObject) Hash()Hash
Hash returns the object Hash, the hash is calculated on-the-fly the firsttime it's called, in all subsequent calls the same Hash is returned evenif the type or the content have changed. The Hash is only generated if thesize of the content is exactly the object size.
func (*MemoryObject)Reader¶
func (o *MemoryObject) Reader() (io.ReadCloser,error)
Reader returns an io.ReadCloser used to read the object's content.
For a MemoryObject, this reader is seekable.
func (*MemoryObject)SetSize¶
func (o *MemoryObject) SetSize(sint64)
SetSize set the object size, a content of the given size should be writtenafterwards
func (*MemoryObject)Writer¶
func (o *MemoryObject) Writer() (io.WriteCloser,error)
Writer returns a ObjectWriter used to write the object's content.
typeObjectType¶
type ObjectTypeint8
ObjectType internal object typeInteger values from 0 to 7 map to those exposed by git.AnyObject is used to represent any from 0 to 7.
const (InvalidObjectObjectType = 0CommitObjectObjectType = 1TreeObjectObjectType = 2BlobObjectObjectType = 3TagObjectObjectType = 4// 5 reserved for future expansionOFSDeltaObjectObjectType = 6REFDeltaObjectObjectType = 7AnyObjectObjectType = -127)
funcParseObjectType¶
func ParseObjectType(valuestring) (typObjectType, errerror)
ParseObjectType parses a string representation of ObjectType. It returns anerror on parse failure.
func (ObjectType)Bytes¶
func (tObjectType) Bytes() []byte
func (ObjectType)IsDelta¶
func (tObjectType) IsDelta()bool
IsDelta returns true for any ObjectType that represents a delta (i.e.REFDeltaObject or OFSDeltaObject).
func (ObjectType)String¶
func (tObjectType) String()string
typePermanentError¶
type PermanentError struct {Errerror}funcNewPermanentError¶
func NewPermanentError(errerror) *PermanentError
func (*PermanentError)Error¶
func (e *PermanentError) Error()string
typeReference¶
type Reference struct {// contains filtered or unexported fields}Reference is a representation of git reference
funcNewHashReference¶
func NewHashReference(nReferenceName, hHash) *Reference
NewHashReference creates a new HashReference reference
funcNewReferenceFromStrings¶
NewReferenceFromStrings creates a reference from name and target as string,the resulting reference can be a SymbolicReference or a HashReference baseon the target provided
funcNewSymbolicReference¶
func NewSymbolicReference(n, targetReferenceName) *Reference
NewSymbolicReference creates a new SymbolicReference reference
func (*Reference)Target¶
func (r *Reference) Target()ReferenceName
Target returns the target of a symbolic reference
typeReferenceName¶
type ReferenceNamestring
ReferenceName reference name's
const (HEADReferenceName = "HEAD"MasterReferenceName = "refs/heads/master"MainReferenceName = "refs/heads/main")
funcNewBranchReferenceName¶
func NewBranchReferenceName(namestring)ReferenceName
NewBranchReferenceName returns a reference name describing a branch based onhis short name.
funcNewNoteReferenceName¶
func NewNoteReferenceName(namestring)ReferenceName
NewNoteReferenceName returns a reference name describing a note based on hisshort name.
funcNewRemoteHEADReferenceName¶
func NewRemoteHEADReferenceName(remotestring)ReferenceName
NewRemoteHEADReferenceName returns a reference name describing a the HEADbranch of a remote.
funcNewRemoteReferenceName¶
func NewRemoteReferenceName(remote, namestring)ReferenceName
NewRemoteReferenceName returns a reference name describing a remote branchbased on his short name and the remote name.
funcNewTagReferenceName¶
func NewTagReferenceName(namestring)ReferenceName
NewTagReferenceName returns a reference name describing a tag based on shorthis name.
func (ReferenceName)IsBranch¶
func (rReferenceName) IsBranch()bool
IsBranch check if a reference is a branch
func (ReferenceName)IsRemote¶
func (rReferenceName) IsRemote()bool
IsRemote check if a reference is a remote
func (ReferenceName)Short¶
func (rReferenceName) Short()string
Short returns the short name of a ReferenceName
func (ReferenceName)String¶
func (rReferenceName) String()string
func (ReferenceName)Validate¶added inv5.11.0
func (rReferenceName) Validate()error
Validate validates a reference name.This follows the git-check-ref-format rules.Seehttps://git-scm.com/docs/git-check-ref-format
It is important to note that this function does not check if the referenceexists in the repository.It only checks if the reference name is valid.This functions does not support the --refspec-pattern, --normalize, and--allow-onelevel options.
Git imposes the following rules on how references are named:
- They can include slash / for hierarchical (directory) grouping, but noslash-separated component can begin with a dot . or end with thesequence .lock.
- They must contain at least one /. This enforces the presence of acategory like heads/, tags/ etc. but the actual names are notrestricted. If the --allow-onelevel option is used, this rule iswaived.
- They cannot have two consecutive dots .. anywhere.
- They cannot have ASCII control characters (i.e. bytes whose values arelower than \040, or \177 DEL), space, tilde ~, caret ^, or colon :anywhere.
- They cannot have question-mark ?, asterisk *, or open bracket [anywhere. See the --refspec-pattern option below for an exception to thisrule.
- They cannot begin or end with a slash / or contain multiple consecutiveslashes (see the --normalize option below for an exception to this rule).
- They cannot end with a dot ..
- They cannot contain a sequence @{.
- They cannot be the single character @.
- They cannot contain a \.
typeReferenceType¶
type ReferenceTypeint8
ReferenceType reference type's
const (InvalidReferenceReferenceType = 0HashReferenceReferenceType = 1SymbolicReferenceReferenceType = 2)
func (ReferenceType)String¶
func (rReferenceType) String()string
typeRevision¶
type Revisionstring
Revision represents a git revisionto get more details about git revisionsplease check git manual page :https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html
typeUnexpectedError¶
type UnexpectedError struct {Errerror}funcNewUnexpectedError¶
func NewUnexpectedError(errerror) *UnexpectedError
func (*UnexpectedError)Error¶
func (e *UnexpectedError) Error()string
Directories¶
| Path | Synopsis |
|---|---|
format | |
commitgraph Package commitgraph implements encoding and decoding of commit-graph files. | Package commitgraph implements encoding and decoding of commit-graph files. |
commitgraph/v2 Package v2 implements encoding and decoding of commit-graph files. | Package v2 implements encoding and decoding of commit-graph files. |
config Package config implements encoding and decoding of git config files. | Package config implements encoding and decoding of git config files. |
gitignore Package gitignore implements matching file system paths to gitignore patterns that can be automatically read from a git repository tree in the order of definition priorities. | Package gitignore implements matching file system paths to gitignore patterns that can be automatically read from a git repository tree in the order of definition priorities. |
idxfile Package idxfile implements encoding and decoding of packfile idx files. | Package idxfile implements encoding and decoding of packfile idx files. |
index Package index implements encoding and decoding of index format files. | Package index implements encoding and decoding of index format files. |
objfile Package objfile implements encoding and decoding of object files. | Package objfile implements encoding and decoding of object files. |
packfile Package packfile implements encoding and decoding of packfile format. | Package packfile implements encoding and decoding of packfile format. |
pktline Package pktline implements reading payloads form pkt-lines and encoding pkt-lines from payloads. | Package pktline implements reading payloads form pkt-lines and encoding pkt-lines from payloads. |
package hash provides a way for managing the underlying hash implementations used across go-git. | package hash provides a way for managing the underlying hash implementations used across go-git. |
Package object contains implementations of all Git objects and utility functions to work with them. | Package object contains implementations of all Git objects and utility functions to work with them. |
commitgraph Package commitgraph provides an interface for efficient traversal over Git commit graph either through the regular object storage, or optionally with the index stored in commit-graph file (Git 2.18+). | Package commitgraph provides an interface for efficient traversal over Git commit graph either through the regular object storage, or optionally with the index stored in commit-graph file (Git 2.18+). |
protocol | |
packp/capability Package capability defines the server and client capabilities. | Package capability defines the server and client capabilities. |
packp/sideband Package sideband implements a sideband mutiplex/demultiplexer | Package sideband implements a sideband mutiplex/demultiplexer |
Package revlist provides support to access the ancestors of commits, in a similar way as the git-rev-list command. | Package revlist provides support to access the ancestors of commits, in a similar way as the git-rev-list command. |
Package storer defines the interfaces to store objects, references, etc. | Package storer defines the interfaces to store objects, references, etc. |
Package transport includes the implementation for different transport protocols. | Package transport includes the implementation for different transport protocols. |
client Package client contains helper function to deal with the different client protocols. | Package client contains helper function to deal with the different client protocols. |
file Package file implements the file transport protocol. | Package file implements the file transport protocol. |
git Package git implements the git transport protocol. | Package git implements the git transport protocol. |
http Package http implements the HTTP transport protocol. | Package http implements the HTTP transport protocol. |
internal/common Package common implements the git pack protocol with a pluggable transport. | Package common implements the git pack protocol with a pluggable transport. |
server Package server implements the git server protocol. | Package server implements the git server protocol. |
ssh Package ssh implements the SSH transport protocol. | Package ssh implements the SSH transport protocol. |
test Package test implements common test suite for different transport implementations. | Package test implements common test suite for different transport implementations. |