store

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NewBranchFlag = -1
)

Variables

View Source
var (
	ErrInvalidHead = errors.New("error: invalid HEAD format")
	ErrIOHandling  = errors.New("IO handling error")
)
View Source
var (
	ErrInvalidIdentifier = errors.New("fatal: invalid identifier")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Conf         *Config
	Idx          *Index
	Head         *Head
	Refs         *Refs
	RootGoitPath string
}

func NewClient

func NewClient(config *Config, index *Index, head *Head, refs *Refs, rootGoitPath string) *Client

type Config

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

func NewConfig

func NewConfig(rootGoitDir string) (*Config, error)

func (*Config) Add

func (c *Config) Add(ident, key, value string, isGlobal bool)

func (*Config) GetEmail added in v1.3.0

func (c *Config) GetEmail() string

func (*Config) GetUserName added in v1.3.0

func (c *Config) GetUserName() string

func (*Config) IsUserSet

func (c *Config) IsUserSet() bool

func (*Config) Write

func (c *Config) Write(configPath string, isGlobal bool) error

type Entry

type Entry struct {
	Hash       sha.SHA1
	NameLength uint16
	Path       []byte
}

func NewEntry

func NewEntry(hash sha.SHA1, path []byte) *Entry
type Head struct {
	Reference string
	Commit    *object.Commit
}

func NewHead

func NewHead(rootGoitPath string) (*Head, error)

func (*Head) Update added in v1.8.0

func (h *Head) Update(rootGoitPath, newRef string) error
type Header struct {
	Signature [4]byte
	Version   uint32
	EntryNum  uint32
}

type Index

type Index struct {
	Header
	Entries []*Entry // sorted entries
}

func NewIndex

func NewIndex(rootGoitPath string) (*Index, error)

func (*Index) DeleteEntry added in v1.4.0

func (idx *Index) DeleteEntry(rootGoitPath string, entry *Entry) error

func (*Index) DeleteUntrackedFiles

func (idx *Index) DeleteUntrackedFiles(rootGoitPath string) error

func (*Index) GetEntry added in v1.4.0

func (idx *Index) GetEntry(path []byte) (int, *Entry, bool)

return the position of entry, entry, and flag to tell the entry is found or not

func (*Index) Update

func (idx *Index) Update(rootGoitPath string, hash sha.SHA1, path []byte) (bool, error)

type Refs added in v1.8.0

type Refs struct {
	Heads []*branch
}

func NewRefs added in v1.8.0

func NewRefs(rootGoitPath string) (*Refs, error)

func (*Refs) AddBranch added in v1.8.0

func (r *Refs) AddBranch(rootGoitPath, newBranchName string, newBranchHash sha.SHA1) error

func (*Refs) DeleteBranch added in v1.8.0

func (r *Refs) DeleteBranch(rootGoitPath, headBranchName, deleteBranchName string) error

func (*Refs) ListBranches added in v1.8.0

func (r *Refs) ListBranches(headBranchName string)

func (*Refs) RenameBranch added in v1.8.0

func (r *Refs) RenameBranch(head *Head, rootGoitPath, newBranchName string) error

Jump to

Keyboard shortcuts

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