dotgit

package
v4.0.0-rc2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

https://github.com/git/git/blob/master/Documentation/gitrepository-layout.txt

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned by New when the path is not found.
	ErrNotFound = errors.New("path not found")
	// ErrIdxNotFound is returned by Idxfile when the idx file is not found
	ErrIdxNotFound = errors.New("idx file not found")
	// ErrPackfileNotFound is returned by Packfile when the packfile is not found
	ErrPackfileNotFound = errors.New("packfile not found")
	// ErrConfigNotFound is returned by Config when the config is not found
	ErrConfigNotFound = errors.New("config file not found")
	// ErrPackedRefsDuplicatedRef is returned when a duplicated reference is
	// found in the packed-ref file. This is usually the case for corrupted git
	// repositories.
	ErrPackedRefsDuplicatedRef = errors.New("duplicated ref found in packed-ref file")
	// ErrPackedRefsBadFormat is returned when the packed-ref file corrupt.
	ErrPackedRefsBadFormat = errors.New("malformed packed-ref")
	// ErrSymRefTargetNotFound is returned when a symbolic reference is
	// targeting a non-existing object. This usually means the repository
	// is corrupt.
	ErrSymRefTargetNotFound = errors.New("symbolic reference target not found")
)

Functions

This section is empty.

Types

type DotGit

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

The DotGit type represents a local git repository on disk. This type is not zero-value-safe, use the New function to initialize it.

func New

func New(fs fs.Filesystem) *DotGit

New returns a DotGit value ready to be used. The path argument must be the absolute path of a git repository directory (e.g. "/foo/bar/.git").

func (*DotGit) Config

func (d *DotGit) Config() (fs.File, error)

Config returns the path of the config file

func (*DotGit) ConfigWriter

func (d *DotGit) ConfigWriter() (fs.File, error)

func (*DotGit) NewObject

func (d *DotGit) NewObject() (*ObjectWriter, error)

NewObject return a writer for a new object file.

func (*DotGit) NewObjectPack

func (d *DotGit) NewObjectPack() (*PackWriter, error)

NewObjectPack return a writer for a new packfile, it saves the packfile to disk and also generates and save the index for the given packfile.

func (*DotGit) Object

func (d *DotGit) Object(h core.Hash) (fs.File, error)

Object return a fs.File poiting the object file, if exists

func (*DotGit) ObjectPack

func (d *DotGit) ObjectPack(hash core.Hash) (fs.File, error)

ObjectPack returns a fs.File of the given packfile

func (*DotGit) ObjectPackIdx

func (d *DotGit) ObjectPackIdx(hash core.Hash) (fs.File, error)

ObjectPackIdx returns a fs.File of the index file for a given packfile

func (*DotGit) ObjectPacks

func (d *DotGit) ObjectPacks() ([]core.Hash, error)

ObjectPacks returns the list of availables packfiles

func (*DotGit) Objects

func (d *DotGit) Objects() ([]core.Hash, error)

Objects returns a slice with the hashes of objects found under the .git/objects/ directory.

func (*DotGit) Ref

func (d *DotGit) Ref(name core.ReferenceName) (*core.Reference, error)

Ref returns the reference for a given reference name.

func (*DotGit) Refs

func (d *DotGit) Refs() ([]*core.Reference, error)

Refs scans the git directory collecting references, which it returns. Symbolic references are resolved and included in the output.

func (*DotGit) SetRef

func (d *DotGit) SetRef(r *core.Reference) error

type ObjectWriter

type ObjectWriter struct {
	objfile.Writer
	// contains filtered or unexported fields
}

func (*ObjectWriter) Close

func (w *ObjectWriter) Close() error

type PackWriter

type PackWriter struct {
	Notify func(h core.Hash, i idxfile.Idxfile)
	// contains filtered or unexported fields
}

func (*PackWriter) Close

func (w *PackWriter) Close() error

func (*PackWriter) Write

func (w *PackWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL