Documentation ¶
Overview ¶
Package backend contains structs and methods to store and retrieve data from the .git directory
Index ¶
- Constants
- Variables
- type Backend
- func (b *Backend) Close() (err error)
- func (b *Backend) HasObject(oid ginternals.Oid) (bool, error)
- func (b *Backend) Init(branchName string) error
- func (b *Backend) InitWithOptions(branchName string, opts InitOptions) error
- func (b *Backend) Object(oid ginternals.Oid) (*object.Object, error)
- func (b *Backend) Path() string
- func (b *Backend) Reference(name string) (*ginternals.Reference, error)
- func (b *Backend) WalkLooseObjectIDs(f packfile.OidWalkFunc) (err error)
- func (b *Backend) WalkPackedObjectIDs(f packfile.OidWalkFunc) error
- func (b *Backend) WalkReferences(f RefWalkFunc) error
- func (b *Backend) WriteObject(o *object.Object) (ginternals.Oid, error)
- func (b *Backend) WriteReference(ref *ginternals.Reference) error
- func (b *Backend) WriteReferenceSafe(ref *ginternals.Reference) error
- type InitOptions
- type RefWalkFunc
Constants ¶
const ( CfgCore = "core" CfgCoreFormatVersion = "repositoryformatversion" CfgCoreFileMode = "filemode" CfgCoreBare = "bare" CfgCoreLogAllRefUpdate = "logallrefupdates" CfgCoreIgnoreCase = "ignorecase" CfgCorePrecomposeUnicode = "precomposeunicode" )
.git/Config config keys
Variables ¶
var WalkStop = errors.New("stop walking") //nolint // the linter expects all errors to start with Err, but since here we're faking an error we don't want that
WalkStop is a fake error used to tell Walk() to stop
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is a Backend implementation that uses the filesystem to store data
func (*Backend) Close ¶
Close frees the resources used by the Backend This method cannot be called concurrently with other methods
func (*Backend) HasObject ¶
func (b *Backend) HasObject(oid ginternals.Oid) (bool, error)
HasObject returns whether an object exists in the odb This method can be called concurrently
func (*Backend) Init ¶
Init initializes a repository. This method cannot be called concurrently with other methods. Calling this method on an existing repository is safe. It will not overwrite things that are already there, but will add what's missing.
func (*Backend) InitWithOptions ¶
func (b *Backend) InitWithOptions(branchName string, opts InitOptions) error
InitWithOptions initializes a repository using the provided options.
This method cannot be called concurrently with other methods. Calling this method on an existing repository is safe. It will not overwrite things that are already there, but will add what's missing.
func (*Backend) Object ¶
Object returns the object that has given oid This method can be called concurrently
func (*Backend) Reference ¶
func (b *Backend) Reference(name string) (*ginternals.Reference, error)
Reference returns a stored reference from its name ErrRefNotFound is returned if the reference doesn't exists This method can be called concurrently
func (*Backend) WalkLooseObjectIDs ¶
func (b *Backend) WalkLooseObjectIDs(f packfile.OidWalkFunc) (err error)
WalkLooseObjectIDs runs the provided method on all the oids of all the packfiles
func (*Backend) WalkPackedObjectIDs ¶
func (b *Backend) WalkPackedObjectIDs(f packfile.OidWalkFunc) error
WalkPackedObjectIDs runs the provided method on all the oids of all the packfiles
func (*Backend) WalkReferences ¶
func (b *Backend) WalkReferences(f RefWalkFunc) error
WalkReferences runs the provided method on all the references
func (*Backend) WriteObject ¶
WriteObject adds an object to the odb This method can be called concurrently
func (*Backend) WriteReference ¶
func (b *Backend) WriteReference(ref *ginternals.Reference) error
WriteReference writes the given reference on disk. If the reference already exists it will be overwritten
func (*Backend) WriteReferenceSafe ¶
func (b *Backend) WriteReferenceSafe(ref *ginternals.Reference) error
WriteReferenceSafe writes the given reference on disk. ErrRefExists is returned if the reference already exists
type InitOptions ¶
type InitOptions struct { // CreateSymlink will create a .git FILE that will contains a path // to the repo. CreateSymlink bool }
InitOptions represents all the options that can be used to create a repository
type RefWalkFunc ¶
type RefWalkFunc = func(ref *ginternals.Reference) error
RefWalkFunc represents a function that will be applied on all references found by Walk()