go-git: github.com/go-git/go-git/storage/filesystem Index | Files | Directories

package filesystem

import "github.com/go-git/go-git/storage/filesystem"

Package filesystem is a storage backend base on filesystems


Package Files

config.go deltaobject.go index.go module.go object.go reference.go shallow.go storage.go

func NewPackfileIter Uses

func NewPackfileIter(
    fs billy.Filesystem,
    f billy.File,
    idxFile billy.File,
    t plumbing.ObjectType,
    keepPack bool,
) (storer.EncodedObjectIter, error)

NewPackfileIter returns a new EncodedObjectIter for the provided packfile and object type. Packfile and index file will be closed after they're used. If keepPack is true the packfile won't be closed after the iteration finished.

type ConfigStorage Uses

type ConfigStorage struct {
    // contains filtered or unexported fields

func (*ConfigStorage) Config Uses

func (c *ConfigStorage) Config() (conf *config.Config, err error)

func (*ConfigStorage) SetConfig Uses

func (c *ConfigStorage) SetConfig(cfg *config.Config) (err error)

type IndexStorage Uses

type IndexStorage struct {
    // contains filtered or unexported fields

func (*IndexStorage) Index Uses

func (s *IndexStorage) Index() (i *index.Index, err error)

func (*IndexStorage) SetIndex Uses

func (s *IndexStorage) SetIndex(idx *index.Index) (err error)

type ModuleStorage Uses

type ModuleStorage struct {
    // contains filtered or unexported fields

func (*ModuleStorage) Module Uses

func (s *ModuleStorage) Module(name string) (storage.Storer, error)

type ObjectStorage Uses

type ObjectStorage struct {
    // contains filtered or unexported fields

func NewObjectStorage Uses

func NewObjectStorage(dir *dotgit.DotGit, objectCache cache.Object) *ObjectStorage

NewObjectStorage creates a new ObjectStorage with the given .git directory and cache.

func NewObjectStorageWithOptions Uses

func NewObjectStorageWithOptions(dir *dotgit.DotGit, objectCache cache.Object, ops Options) *ObjectStorage

NewObjectStorageWithOptions creates a new ObjectStorage with the given .git directory, cache and extra options

func (*ObjectStorage) Close Uses

func (s *ObjectStorage) Close() error

Close closes all opened files.

func (*ObjectStorage) DeleteLooseObject Uses

func (s *ObjectStorage) DeleteLooseObject(hash plumbing.Hash) error

func (*ObjectStorage) DeleteOldObjectPackAndIndex Uses

func (s *ObjectStorage) DeleteOldObjectPackAndIndex(h plumbing.Hash, t time.Time) error

func (*ObjectStorage) DeltaObject Uses

func (s *ObjectStorage) DeltaObject(t plumbing.ObjectType,
    h plumbing.Hash) (plumbing.EncodedObject, error)

DeltaObject returns the object with the given hash, by searching for it in the packfile and the git object directories.

func (*ObjectStorage) EncodedObject Uses

func (s *ObjectStorage) EncodedObject(t plumbing.ObjectType, h plumbing.Hash) (plumbing.EncodedObject, error)

EncodedObject returns the object with the given hash, by searching for it in the packfile and the git object directories.

func (*ObjectStorage) EncodedObjectSize Uses

func (s *ObjectStorage) EncodedObjectSize(h plumbing.Hash) (
    size int64, err error)

EncodedObjectSize returns the plaintext size of the given object, without actually reading the full object data from storage.

func (*ObjectStorage) ForEachObjectHash Uses

func (s *ObjectStorage) ForEachObjectHash(fun func(plumbing.Hash) error) error

func (*ObjectStorage) HasEncodedObject Uses

func (s *ObjectStorage) HasEncodedObject(h plumbing.Hash) (err error)

HasEncodedObject returns nil if the object exists, without actually reading the object data from storage.

func (*ObjectStorage) HashesWithPrefix Uses

func (s *ObjectStorage) HashesWithPrefix(prefix []byte) ([]plumbing.Hash, error)

func (*ObjectStorage) IterEncodedObjects Uses

func (s *ObjectStorage) IterEncodedObjects(t plumbing.ObjectType) (storer.EncodedObjectIter, error)

IterEncodedObjects returns an iterator for all the objects in the packfile with the given type.

func (*ObjectStorage) LooseObjectTime Uses

func (s *ObjectStorage) LooseObjectTime(hash plumbing.Hash) (time.Time, error)

func (*ObjectStorage) NewEncodedObject Uses

func (s *ObjectStorage) NewEncodedObject() plumbing.EncodedObject

func (*ObjectStorage) ObjectPacks Uses

func (s *ObjectStorage) ObjectPacks() ([]plumbing.Hash, error)

func (*ObjectStorage) PackfileWriter Uses

func (s *ObjectStorage) PackfileWriter() (io.WriteCloser, error)

func (*ObjectStorage) Reindex Uses

func (s *ObjectStorage) Reindex()

Reindex indexes again all packfiles. Useful if git changed packfiles externally

func (*ObjectStorage) SetEncodedObject Uses

func (s *ObjectStorage) SetEncodedObject(o plumbing.EncodedObject) (h plumbing.Hash, err error)

SetEncodedObject adds a new object to the storage.

type Options Uses

type Options struct {
    // ExclusiveAccess means that the filesystem is not modified externally
    // while the repo is open.
    ExclusiveAccess bool
    // KeepDescriptors makes the file descriptors to be reused but they will
    // need to be manually closed calling Close().
    KeepDescriptors bool
    // MaxOpenDescriptors is the max number of file descriptors to keep
    // open. If KeepDescriptors is true, all file descriptors will remain open.
    MaxOpenDescriptors int

Options holds configuration for the storage.

type ReferenceStorage Uses

type ReferenceStorage struct {
    // contains filtered or unexported fields

func (*ReferenceStorage) CheckAndSetReference Uses

func (r *ReferenceStorage) CheckAndSetReference(ref, old *plumbing.Reference) error

func (*ReferenceStorage) CountLooseRefs Uses

func (r *ReferenceStorage) CountLooseRefs() (int, error)

func (*ReferenceStorage) IterReferences Uses

func (r *ReferenceStorage) IterReferences() (storer.ReferenceIter, error)

func (*ReferenceStorage) PackRefs Uses

func (r *ReferenceStorage) PackRefs() error

func (*ReferenceStorage) Reference Uses

func (r *ReferenceStorage) Reference(n plumbing.ReferenceName) (*plumbing.Reference, error)

func (*ReferenceStorage) RemoveReference Uses

func (r *ReferenceStorage) RemoveReference(n plumbing.ReferenceName) error

func (*ReferenceStorage) SetReference Uses

func (r *ReferenceStorage) SetReference(ref *plumbing.Reference) error

type ShallowStorage Uses

type ShallowStorage struct {
    // contains filtered or unexported fields

ShallowStorage where the shallow commits are stored, an internal to manipulate the shallow file

func (*ShallowStorage) SetShallow Uses

func (s *ShallowStorage) SetShallow(commits []plumbing.Hash) error

SetShallow save the shallows in the shallow file in the .git folder as one commit per line represented by 40-byte hexadecimal object terminated by a newline.

func (*ShallowStorage) Shallow Uses

func (s *ShallowStorage) Shallow() ([]plumbing.Hash, error)

Shallow return the shallow commits reading from shallo file from .git

type Storage Uses

type Storage struct {
    // contains filtered or unexported fields

Storage is an implementation of git.Storer that stores data on disk in the standard git format (this is, the .git directory). Zero values of this type are not safe to use, see the NewStorage function below.

func NewStorage Uses

func NewStorage(fs billy.Filesystem, cache cache.Object) *Storage

NewStorage returns a new Storage backed by a given `fs.Filesystem` and cache.

func NewStorageWithOptions Uses

func NewStorageWithOptions(fs billy.Filesystem, cache cache.Object, ops Options) *Storage

NewStorageWithOptions returns a new Storage with extra options, backed by a given `fs.Filesystem` and cache.

func (*Storage) Filesystem Uses

func (s *Storage) Filesystem() billy.Filesystem

Filesystem returns the underlying filesystem

func (*Storage) Init Uses

func (s *Storage) Init() error

Init initializes .git directory



Package filesystem imports 18 packages (graph). Updated 2020-07-22. Refresh now. Tools for package owners.