ref

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HeadPattern = regexp.MustCompile(`^[-_0-9a-zA-Z/]+$`)
	HashPattern = regexp.MustCompile(`^[a-f0-9]{32}$`)
)
View Source
var ErrKeyNotFound = fmt.Errorf("key not found")

Functions

func CommitHead

func CommitHead(s Store, name string, sum []byte, commit *objects.Commit) error

func CommitMerge

func CommitMerge(s Store, name string, sum []byte, commit *objects.Commit) error

func CopyRef

func CopyRef(s Store, srcName, dstName string) (sum []byte, err error)

func DeleteAllRemoteRefs

func DeleteAllRemoteRefs(s Store, remote string) error

func DeleteHead

func DeleteHead(s Store, name string) error

func DeleteRef

func DeleteRef(s Store, name string) error

func DeleteRemoteRef

func DeleteRemoteRef(s Store, remote, name string) error

func DeleteTag

func DeleteTag(s Store, name string) error

func GetHead

func GetHead(s Store, name string) ([]byte, error)

func GetRef

func GetRef(s Store, name string) ([]byte, error)

func GetRemoteRef

func GetRemoteRef(s Store, remote, name string) ([]byte, error)

func GetTag

func GetTag(s Store, name string) ([]byte, error)

func InterpretCommitName

func InterpretCommitName(db objects.Store, rs Store, commitStr string, excludeTag bool) (name string, hash []byte, commit *objects.Commit, err error)

func IsAncestorOf

func IsAncestorOf(db objects.Store, commit1, commit2 []byte) (ok bool, err error)

IsAncestorOf returns true if "commit1" is ancestor of "commit2"

func ListAllRefs

func ListAllRefs(s Store) (map[string][]byte, error)

func ListHeads

func ListHeads(s Store) (map[string][]byte, error)

func ListLocalRefs

func ListLocalRefs(s Store) (map[string][]byte, error)

func ListRemoteRefs

func ListRemoteRefs(s Store, remote string) (map[string][]byte, error)

func ListTags

func ListTags(s Store) (map[string][]byte, error)

func ParseNavigationChars

func ParseNavigationChars(commitStr string) (commitName string, numPeel int, err error)

func PeelCommit

func PeelCommit(db objects.Store, hash []byte, commit *objects.Commit, numPeel int) ([]byte, *objects.Commit, error)

func RemoteRef

func RemoteRef(remote, name string) string

func RenameAllRemoteRefs

func RenameAllRemoteRefs(s Store, oldRemote, newRemote string) error

func RenameRef

func RenameRef(s Store, oldName, newName string) (sum []byte, err error)

func SaveRef

func SaveRef(s Store, name string, commit []byte, authorName, authorEmail, action, message string) error

func SaveRemoteRef

func SaveRemoteRef(s Store, remote, name string, commit []byte, authorName, authorEmail, action, message string) error

func SaveTag

func SaveTag(s Store, name string, sum []byte) error

func SeekCommonAncestor

func SeekCommonAncestor(db objects.Store, commits ...[]byte) (baseCommit []byte, err error)

Types

type CommitsQueue

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

func NewCommitsQueue

func NewCommitsQueue(db objects.Store, initialSums [][]byte) (*CommitsQueue, error)

func (*CommitsQueue) Insert

func (q *CommitsQueue) Insert(sum []byte) (err error)

func (*CommitsQueue) InsertParents

func (q *CommitsQueue) InsertParents(c *objects.Commit) (err error)

func (*CommitsQueue) Len

func (q *CommitsQueue) Len() int

func (*CommitsQueue) Less

func (q *CommitsQueue) Less(i, j int) bool

func (*CommitsQueue) Pop

func (q *CommitsQueue) Pop() (sum []byte, commit *objects.Commit, err error)

func (*CommitsQueue) PopInsertParents

func (q *CommitsQueue) PopInsertParents() (sum []byte, commit *objects.Commit, err error)

func (*CommitsQueue) PopUntil

func (q *CommitsQueue) PopUntil(b []byte) (sum []byte, commit *objects.Commit, err error)

func (*CommitsQueue) RemoveAncestors

func (q *CommitsQueue) RemoveAncestors(sums [][]byte) error

func (*CommitsQueue) Seen

func (q *CommitsQueue) Seen(b []byte) bool

func (*CommitsQueue) Swap

func (q *CommitsQueue) Swap(i, j int)

type Reflog

type Reflog struct {
	OldOID      []byte
	NewOID      []byte
	AuthorName  string
	AuthorEmail string
	Time        time.Time
	Action      string
	Message     string
}

func (*Reflog) Read

func (rec *Reflog) Read(b []byte) (n int, err error)

func (*Reflog) WriteTo

func (rec *Reflog) WriteTo(w io.Writer) (total int64, err error)

type ReflogReader

type ReflogReader interface {
	Read() (*Reflog, error)
	Close() error
}

type Store

type Store interface {
	SetWithLog(key string, val []byte, log *Reflog) error
	Set(key string, val []byte) error
	Get(key string) (val []byte, err error)
	Delete(key string) error
	Filter(prefix string) (m map[string][]byte, err error)
	FilterKey(prefix string) (keys []string, err error)
	Rename(oldKey, newKey string) (err error)
	Copy(srcKey, dstKey string) (err error)
	LogReader(key string) (ReflogReader, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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