store

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: MIT Imports: 14 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
	Ignore       *Ignore
	RootGoitPath string
}

func NewClient

func NewClient(config *Config, index *Index, head *Head, refs *Refs, ignore *Ignore, 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 DiffEntry added in v1.12.0

type DiffEntry struct {
	Dt    diffType
	Entry *Entry
}

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) Reset added in v1.10.0

func (h *Head) Reset(rootGoitPath string, refs *Refs, hash sha.SHA1) error

reset Head to the specified state by hash This method does not change Head.Reference, just change Commit

func (*Head) Update added in v1.8.0

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

type Ignore added in v1.9.2

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

func NewIgnore added in v1.9.2

func NewIgnore(rootGoitPath string) (*Ignore, error)

func (*Ignore) IsIncluded added in v1.9.2

func (i *Ignore) IsIncluded(path string, index *Index) bool

return true if the parameter is included in ignore list

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, path []byte) error

func (*Index) DiffWithTree added in v1.12.0

func (idx *Index) DiffWithTree(tree *object.Tree) ([]*DiffEntry, error)

func (*Index) GetEntriesByDirectory added in v1.11.1

func (idx *Index) GetEntriesByDirectory(dirName string) []*Entry

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) IsRegisteredAsDirectory added in v1.11.0

func (idx *Index) IsRegisteredAsDirectory(dirName string) bool

func (*Index) Reset added in v1.10.0

func (idx *Index) Reset(rootGoitPath string, hash sha.SHA1) error

func (*Index) Update

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

type LogRecord added in v1.10.0

type LogRecord struct {
	Hash sha.SHA1
	Head string
	// contains filtered or unexported fields
}

type Reflog added in v1.9.0

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

func NewReflog added in v1.9.0

func NewReflog(rootGoitPath string, head *Head, refs *Refs) (*Reflog, error)

func (*Reflog) GetRecord added in v1.10.0

func (r *Reflog) GetRecord(num int) (*LogRecord, error)

func (*Reflog) Show added in v1.9.0

func (r *Reflog) Show()

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) IsBranchExist added in v1.8.1

func (r *Refs) IsBranchExist(branchName string) bool

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(rootGoitPath, curBranchName, newBranchName string) error

func (*Refs) UpdateBranchHash added in v1.8.1

func (r *Refs) UpdateBranchHash(rootGoitPath, branchName string, newHash sha.SHA1) error

Jump to

Keyboard shortcuts

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