gitdir

package
v3.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

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 on the
	// repository.
	ErrIdxNotFound = errors.New("idx file not found")
	// ErrPackfileNotFound is returned by Packfile when the packfile is not found
	// on the repository.
	ErrPackfileNotFound = errors.New("packfile not found")
)
View Source
var (
	// 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 GitDir

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

The GitDir 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.FS, path string) (*GitDir, error)

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

func (*GitDir) Capabilities

func (d *GitDir) Capabilities() (*common.Capabilities, error)

Capabilities scans the git directory collection capabilities, which it returns.

func (*GitDir) Idxfile

func (d *GitDir) Idxfile() (fs.FS, string, error)

Idxfile returns the path of the idx file (really, it returns the path of the first file in the "objects/pack/" directory with an ".idx" extension.

func (*GitDir) Packfile

func (d *GitDir) Packfile() (fs.FS, string, error)

Packfile returns the path of the packfile (really, it returns the path of the first file in the "objects/pack/" directory with a ".pack" extension.

func (*GitDir) Refs

func (d *GitDir) Refs() (map[string]core.Hash, error)

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

Jump to

Keyboard shortcuts

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