odb

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INFO_AUTO_MERGING = iota
	CONFLICT_CONTENTS
	CONFLICT_BINARY
	CONFLICT_FILE_DIRECTORY
	CONFLICT_DISTINCT_MODES
	CONFLICT_MODIFY_DELETE
	// Regular rename
	CONFLICT_RENAME_RENAME
	CONFLICT_RENAME_COLLIDES
	CONFLICT_RENAME_DELETE
	CONFLICT_DIR_RENAME_SUGGESTED
	INFO_DIR_RENAME_APPLIED
	// Special directory rename cases
	INFO_DIR_RENAME_SKIPPED_DUE_TO_RERENAME
	CONFLICT_DIR_RENAME_FILE_IN_WAY
	CONFLICT_DIR_RENAME_COLLISION
	CONFLICT_DIR_RENAME_SPLIT
)
View Source
const (
	MERGE_VARIANT_NORMAL = 0
	MERGE_VARIANT_OURS   = 1
	MERGE_VARIANT_THEIRS = 2
)
View Source
const (
	DefaultHashALGO        = "BLAKE3"
	DefaultCompressionALGO = "zstd"
)
View Source
const (
	MERGE_HEAD       plumbing.ReferenceName = "MERGE_HEAD"
	FETCH_HEAD       plumbing.ReferenceName = "FETCH_HEAD"
	CHERRY_PICK_HEAD plumbing.ReferenceName = "CHERRY_PICK_HEAD"
	AUTO_MERGE       plumbing.ReferenceName = "AUTO_MERGE"
	MERGE_AUTOSTASH  plumbing.ReferenceName = "MERGE_AUTOSTASH"
)

Variables

View Source
var (
	ErrNotSpecialReferenceName = errors.New("not special reference name")
)

Functions

func IsZetaDir

func IsZetaDir(dir string) bool

func NewSingleBar

func NewSingleBar(r io.Reader, total int64, current int64, oid plumbing.Hash, round int) (io.Reader, io.Closer)

Types

type ChangeEntry

type ChangeEntry struct {
	Path     string
	Ancestor *object.TreeEntry
	Our      *object.TreeEntry
	Their    *object.TreeEntry
}

type Conflict

type Conflict struct {
	// Ancestor is the conflict entry of the merge-base.
	Ancestor ConflictEntry `json:"ancestor"`
	// Our is the conflict entry of ours.
	Our ConflictEntry `json:"our"`
	// Their is the conflict entry of theirs.
	Their ConflictEntry `json:"their"`
	// Types: conflict types
	Types int `json:"types"`
}

Conflict represents a merge conflict for a single file.

type ConflictEntry

type ConflictEntry struct {
	// Path is the path of the conflicting file.
	Path string `json:"path"`
	// Mode is the mode of the conflicting file.
	Mode filemode.FileMode `json:"mode"`
	Hash plumbing.Hash     `json:"oid"`
}

ConflictEntry represents a conflict entry which is one of the sides of a conflict.

type Entries

type Entries []*Entry

type Entry

type Entry struct {
	Hash plumbing.Hash
	Size int64
}

type Fetcher

type Fetcher func(ctx context.Context, entries Entries) error

type HaveObject

type HaveObject struct {
	Hash plumbing.Hash
	Size int64
}

type Indicators

type Indicators interface {
	Add(int)
}

type MakeBar

type MakeBar func(r io.Reader, total int64, current int64, oid plumbing.Hash, round int) (io.Reader, io.Closer)

type MergeDriver

type MergeDriver func(ctx context.Context, o, a, b string, labelO, labelA, labelB string) (string, bool, error)

type MergeOptions

type MergeOptions struct {
	Branch1       string
	Branch2       string
	DetectRenames bool
	RenameLimit   int
	RenameScore   int
	Variant       int
	Textconv      bool
	MergeDriver   MergeDriver
	TextGetter    TextGetter
}

type MergeResult

type MergeResult struct {
	NewTree   plumbing.Hash `json:"new-tree"`
	Conflicts []*Conflict   `json:"conflicts,omitempty"`
	Messages  []string      `json:"messages,omitempty"`
}

func (*MergeResult) Error added in v0.14.0

func (mr *MergeResult) Error() string

type ODB

type ODB struct {
	*backend.Database
	// contains filtered or unexported fields
}

func NewODB

func NewODB(root string, opts ...backend.Option) (*ODB, error)

func (*ODB) CountingObjects

func (o *ODB) CountingObjects(ctx context.Context, commit, deepenFrom plumbing.Hash, maxEntries int, fetcher Fetcher) error

CountingObjects: counting objects for current commit and parents... deepenFrom is zero --> counting all objects

func (*ODB) CountingSliceObjects

func (o *ODB) CountingSliceObjects(ctx context.Context, target plumbing.Hash, sparseDirs []string, maxEntries int, fetcher Fetcher) error

CountingSliceObjects: counting all objects for current commit

func (*ODB) DecodeFragments

func (d *ODB) DecodeFragments(ctx context.Context, w io.Writer, fe *object.TreeEntry) error

func (*ODB) DecodeTo

func (d *ODB) DecodeTo(ctx context.Context, w io.Writer, oid plumbing.Hash, n int64) error

func (*ODB) DeepenFrom

func (d *ODB) DeepenFrom() (plumbing.Hash, error)

func (*ODB) Delta

func (o *ODB) Delta(ctx context.Context, newRev, shallow, head plumbing.Hash) (*PushObjects, error)

func (*ODB) Diff3Merge

func (d *ODB) Diff3Merge(ctx context.Context, o, a, b string, labelO, labelA, labelB string) (string, bool, error)

func (*ODB) DoTransfer

func (d *ODB) DoTransfer(ctx context.Context, oid plumbing.Hash, transfer Transfer, m MakeBar, mode ProgressMode) error

func (*ODB) EmptyTree

func (d *ODB) EmptyTree() *object.Tree

func (*ODB) Exists

func (d *ODB) Exists(oid plumbing.Hash, metadata bool) bool

func (*ODB) ExternalMerge

func (d *ODB) ExternalMerge(ctx context.Context, o, a, b string, labelO, labelA, labelB string) (string, bool, error)

ExternalMerge: use external merge tool --> aka git merge-file.

eg: git merge-file -L VERSION -L VERSION -L VERSION --no-diff3 -p VERSION.a VERSION.o VERSION.b

func (*ODB) Index

func (d *ODB) Index() (i *index.Index, err error)

func (*ODB) LsTreeRecurse

func (d *ODB) LsTreeRecurse(ctx context.Context, root *object.Tree) ([]*TreeEntry, error)

LsTreeRecurse: list all tree entries: merge required

func (*ODB) MergeTree

func (d *ODB) MergeTree(ctx context.Context, o, a, b *object.Tree, opts *MergeOptions) (*MergeResult, error)

MergeTree: three way merge tree

func (*ODB) MetadataUnpack

func (d *ODB) MetadataUnpack(r io.Reader, quiet bool) error

func (*ODB) OnReport

func (d *ODB) OnReport(ctx context.Context, refname plumbing.ReferenceName, reader io.Reader) (result *Report, err error)

func (*ODB) ParseRevExhaustive

func (o *ODB) ParseRevExhaustive(ctx context.Context, oid plumbing.Hash) (*object.Commit, error)

func (*ODB) PushTo

func (d *ODB) PushTo(ctx context.Context, originWriter io.Writer, objects *PushObjects, quiet bool) error

func (*ODB) ResolveSpecReference

func (d *ODB) ResolveSpecReference(name plumbing.ReferenceName) (plumbing.Hash, error)

func (*ODB) Root

func (d *ODB) Root() string

func (*ODB) SetIndex

func (d *ODB) SetIndex(idx *index.Index) (err error)

func (*ODB) Shallow

func (d *ODB) Shallow(oid plumbing.Hash) error

func (*ODB) SpecReferenceRemove

func (d *ODB) SpecReferenceRemove(name plumbing.ReferenceName) error

func (*ODB) SpecReferenceUpdate

func (d *ODB) SpecReferenceUpdate(name plumbing.ReferenceName, oid plumbing.Hash) error

func (*ODB) Unpack

func (d *ODB) Unpack(r io.Reader, expected int, quiet bool) error

func (*ODB) Unshallow

func (d *ODB) Unshallow() error

type ProgressMode

type ProgressMode int
const (
	NO_BAR ProgressMode = iota
	SINGLE_BAR
	MULTI_BARS
)

type PushObjects

type PushObjects struct {
	Metadata     []plumbing.Hash
	Objects      []plumbing.Hash
	LargeObjects []*HaveObject
}

type RenameEntry

type RenameEntry struct {
	Ancestor *TreeEntry
	Our      *TreeEntry
	Their    *TreeEntry
}

type Report

type Report struct {
	ReferenceName plumbing.ReferenceName
	NewRev        string
	Rejected      bool
	Reason        string
}

type TextGetter

type TextGetter func(ctx context.Context, oid plumbing.Hash, textconv bool) (string, string, error)

type Transfer

type Transfer func(offset int64) (transport.SizeReader, error)

type TreeEntry

type TreeEntry struct {
	Path string
	*object.TreeEntry
}

func (*TreeEntry) Equal

func (e *TreeEntry) Equal(other *TreeEntry) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳