go-git.v4: gopkg.in/src-d/go-git.v4/plumbing Index | Files | Directories

package plumbing

import "gopkg.in/src-d/go-git.v4/plumbing"

package plumbing implement the core interfaces and structs used by go-git

Index

Package Files

error.go hash.go memory.go object.go reference.go revision.go

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")
)
var RefRevParseRules = []string{
    "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. These are the same rules as used by git in shorten_unambiguous_ref. See: https://github.com/git/git/blob/e0aaa1b6532cfce93d87af9bc813fb2e7a7ce9d7/refs.c#L417

func HashesSort Uses

func HashesSort(a []Hash)

HashesSort sorts a slice of Hashes in increasing order.

type DeltaObject Uses

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.

type EncodedObject Uses

type EncodedObject interface {
    Hash() Hash
    Type() ObjectType
    SetType(ObjectType)
    Size() int64
    SetSize(int64)
    Reader() (io.ReadCloser, error)
    Writer() (io.WriteCloser, error)
}

Object is a generic representation of any git object

type Hash Uses

type Hash [20]byte

Hash SHA1 hased content

var ZeroHash Hash

ZeroHash is Hash with value zero

func ComputeHash Uses

func ComputeHash(t ObjectType, content []byte) Hash

ComputeHash compute the hash for a given ObjectType and content

func NewHash Uses

func NewHash(s string) Hash

NewHash return a new Hash from a hexadecimal hash representation

func (Hash) IsZero Uses

func (h Hash) IsZero() bool

func (Hash) String Uses

func (h Hash) String() string

type HashSlice Uses

type HashSlice []Hash

HashSlice attaches the methods of sort.Interface to []Hash, sorting in increasing order.

func (HashSlice) Len Uses

func (p HashSlice) Len() int

func (HashSlice) Less Uses

func (p HashSlice) Less(i, j int) bool

func (HashSlice) Swap Uses

func (p HashSlice) Swap(i, j int)

type Hasher Uses

type Hasher struct {
    hash.Hash
}

func NewHasher Uses

func NewHasher(t ObjectType, size int64) Hasher

func (Hasher) Sum Uses

func (h Hasher) Sum() (hash Hash)

type MemoryObject Uses

type MemoryObject struct {
    // contains filtered or unexported fields
}

MemoryObject on memory Object implementation

func (*MemoryObject) Close Uses

func (o *MemoryObject) Close() error

Close releases any resources consumed by the object when it is acting as a ObjectWriter.

func (*MemoryObject) Hash Uses

func (o *MemoryObject) Hash() Hash

Hash returns the object Hash, the hash is calculated on-the-fly the first time it's called, in all subsequent calls the same Hash is returned even if the type or the content have changed. The Hash is only generated if the size of the content is exactly the object size.

func (*MemoryObject) Reader Uses

func (o *MemoryObject) Reader() (io.ReadCloser, error)

Reader returns a ObjectReader used to read the object's content.

func (*MemoryObject) SetSize Uses

func (o *MemoryObject) SetSize(s int64)

SetSize set the object size, a content of the given size should be written afterwards

func (*MemoryObject) SetType Uses

func (o *MemoryObject) SetType(t ObjectType)

SetType sets the ObjectType

func (*MemoryObject) Size Uses

func (o *MemoryObject) Size() int64

Size return the size of the object

func (*MemoryObject) Type Uses

func (o *MemoryObject) Type() ObjectType

Type return the ObjectType

func (*MemoryObject) Write Uses

func (o *MemoryObject) Write(p []byte) (n int, err error)

func (*MemoryObject) Writer Uses

func (o *MemoryObject) Writer() (io.WriteCloser, error)

Writer returns a ObjectWriter used to write the object's content.

type ObjectType Uses

type ObjectType int8

ObjectType internal object type Integer values from 0 to 7 map to those exposed by git. AnyObject is used to represent any from 0 to 7.

const (
    InvalidObject ObjectType = 0
    CommitObject  ObjectType = 1
    TreeObject    ObjectType = 2
    BlobObject    ObjectType = 3
    TagObject     ObjectType = 4
    // 5 reserved for future expansion
    OFSDeltaObject ObjectType = 6
    REFDeltaObject ObjectType = 7

    AnyObject ObjectType = -127
)

func ParseObjectType Uses

func ParseObjectType(value string) (typ ObjectType, err error)

ParseObjectType parses a string representation of ObjectType. It returns an error on parse failure.

func (ObjectType) Bytes Uses

func (t ObjectType) Bytes() []byte

func (ObjectType) IsDelta Uses

func (t ObjectType) IsDelta() bool

IsDelta returns true for any ObjectTyoe that represents a delta (i.e. REFDeltaObject or OFSDeltaObject).

func (ObjectType) String Uses

func (t ObjectType) String() string

func (ObjectType) Valid Uses

func (t ObjectType) Valid() bool

Valid returns true if t is a valid ObjectType.

type PermanentError Uses

type PermanentError struct {
    Err error
}

func NewPermanentError Uses

func NewPermanentError(err error) *PermanentError

func (*PermanentError) Error Uses

func (e *PermanentError) Error() string

type Reference Uses

type Reference struct {
    // contains filtered or unexported fields
}

Reference is a representation of git reference

func NewHashReference Uses

func NewHashReference(n ReferenceName, h Hash) *Reference

NewHashReference creates a new HashReference reference

func NewReferenceFromStrings Uses

func NewReferenceFromStrings(name, target string) *Reference

NewReferenceFromStrings creates a reference from name and target as string, the resulting reference can be a SymbolicReference or a HashReference base on the target provided

func NewSymbolicReference Uses

func NewSymbolicReference(n, target ReferenceName) *Reference

NewSymbolicReference creates a new SymbolicReference reference

func (*Reference) Hash Uses

func (r *Reference) Hash() Hash

Hash return the hash of a hash reference

func (*Reference) Name Uses

func (r *Reference) Name() ReferenceName

Name return the name of a reference

func (*Reference) String Uses

func (r *Reference) String() string

func (*Reference) Strings Uses

func (r *Reference) Strings() [2]string

Strings dump a reference as a [2]string

func (*Reference) Target Uses

func (r *Reference) Target() ReferenceName

Target return the target of a symbolic reference

func (*Reference) Type Uses

func (r *Reference) Type() ReferenceType

Type return the type of a reference

type ReferenceName Uses

type ReferenceName string

ReferenceName reference name's

const (
    HEAD   ReferenceName = "HEAD"
    Master ReferenceName = "refs/heads/master"
)

func NewBranchReferenceName Uses

func NewBranchReferenceName(name string) ReferenceName

NewBranchReferenceName returns a reference name describing a branch based on his short name.

func NewNoteReferenceName Uses

func NewNoteReferenceName(name string) ReferenceName

NewNoteReferenceName returns a reference name describing a note based on his short name.

func NewRemoteHEADReferenceName Uses

func NewRemoteHEADReferenceName(remote string) ReferenceName

NewRemoteHEADReferenceName returns a reference name describing a the HEAD branch of a remote.

func NewRemoteReferenceName Uses

func NewRemoteReferenceName(remote, name string) ReferenceName

NewRemoteReferenceName returns a reference name describing a remote branch based on his short name and the remote name.

func NewTagReferenceName Uses

func NewTagReferenceName(name string) ReferenceName

NewTagReferenceName returns a reference name describing a tag based on short his name.

func (ReferenceName) IsBranch Uses

func (r ReferenceName) IsBranch() bool

IsBranch check if a reference is a branch

func (ReferenceName) IsNote Uses

func (r ReferenceName) IsNote() bool

IsNote check if a reference is a note

func (ReferenceName) IsRemote Uses

func (r ReferenceName) IsRemote() bool

IsRemote check if a reference is a remote

func (ReferenceName) IsTag Uses

func (r ReferenceName) IsTag() bool

IsTag check if a reference is a tag

func (ReferenceName) Short Uses

func (r ReferenceName) Short() string

Short returns the short name of a ReferenceName

func (ReferenceName) String Uses

func (r ReferenceName) String() string

type ReferenceType Uses

type ReferenceType int8

ReferenceType reference type's

const (
    InvalidReference  ReferenceType = 0
    HashReference     ReferenceType = 1
    SymbolicReference ReferenceType = 2
)

func (ReferenceType) String Uses

func (r ReferenceType) String() string

type Revision Uses

type Revision string

Revision represents a git revision to get more details about git revisions please check git manual page : https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html

func (Revision) String Uses

func (r Revision) String() string

type UnexpectedError Uses

type UnexpectedError struct {
    Err error
}

func NewUnexpectedError Uses

func NewUnexpectedError(err error) *UnexpectedError

func (*UnexpectedError) Error Uses

func (e *UnexpectedError) Error() string

Directories

PathSynopsis
cache
filemode
format/commitgraphPackage commitgraph implements encoding and decoding of commit-graph files.
format/configPackage config implements encoding and decoding of git config files.
format/diff
format/gitattributes
format/gitignorePackage 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.
format/idxfilePackage idxfile implements encoding and decoding of packfile idx files.
format/indexPackage index implements encoding and decoding of index format files.
format/objfilePackage objfile implements encoding and decoding of object files.
format/packfilePackage packfile implements encoding and decoding of packfile format.
format/pktlinePackage pktline implements reading payloads form pkt-lines and encoding pkt-lines from payloads.
objectPackage object contains implementations of all Git objects and utility functions to work with them.
object/commitgraphPackage 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
protocol/packp/capabilityPackage capability defines the server and client capabilities.
protocol/packp/sidebandPackage sideband implements a sideband mutiplex/demultiplexer
revlistPackage revlist provides support to access the ancestors of commits, in a similar way as the git-rev-list command.
storerPackage storer defines the interfaces to store objects, references, etc.
transportPackage transport includes the implementation for different transport protocols.
transport/clientPackage client contains helper function to deal with the different client protocols.
transport/filePackage file implements the file transport protocol.
transport/gitPackage git implements the git transport protocol.
transport/httpPackage http implements the HTTP transport protocol.
transport/internal/commonPackage common implements the git pack protocol with a pluggable transport.
transport/serverPackage server implements the git server protocol.
transport/sshPackage ssh implements the SSH transport protocol.
transport/testPackage test implements common test suite for different transport implementations.

Package plumbing imports 11 packages (graph) and is imported by 386 packages. Updated 2019-08-02. Refresh now. Tools for package owners.