store

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidHead = errors.New("error: invalid HEAD format")
)
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
	RootGoitPath string
}

func NewClient

func NewClient(config *Config, index *Index, head Head, 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 string

func NewHead

func NewHead(rootGoitPath string) (Head, 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)

Jump to

Keyboard shortcuts

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