repository

package
v0.0.0-...-179f5c2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package repository implements functionality for git repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(of *ObjectFile) string

Hash hashes the object.

Types

type Object

type Object interface {
	Serialize() []byte
	Deserialize([]byte) error
}

Object represents an object.

type ObjectFile

type ObjectFile struct {
	ObjectType string
	Data       []byte
}

ObjectFile defines the wire format for storing objects in the repository.

func ReadObjectFile

func ReadObjectFile(r *bufio.Reader) (*ObjectFile, error)

ReadObjectFile reads an object file from a reader.

func (*ObjectFile) Write

func (of *ObjectFile) Write(w io.Writer) (int64, error)

type Repository

type Repository struct {
	Worktree string
	GitDir   string
	Config   *ini.File
}

Repository represents a git repository.

func Find

func Find(path string) (*Repository, error)

Find loads the repository at path or any of its parent directories.

func Init

func Init(path string) (*Repository, error)

Init initializes a new got repository.

func Load

func Load(path string) (*Repository, error)

Load loads the repository at path.

func (*Repository) Find

func (r *Repository) Find(name string, ot string, follow bool) string

Find resolves the given object reference.

func (*Repository) GitPath

func (r *Repository) GitPath(ss ...string) string

GitPath returns the path to a file in the repository.

func (*Repository) LoadObject

func (r *Repository) LoadObject(sha string, objectType string) (Object, error)

LoadObject loads an object from the repository.

func (*Repository) WriteObject

func (r *Repository) WriteObject(of *ObjectFile) (string, error)

WriteObject writes the given object to the repository.

Jump to

Keyboard shortcuts

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