core

package
v0.0.0-...-f32120d Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashObjectFromPath

func HashObjectFromPath(path string, oType object.ObjectKind, save bool) (common.Hash, error)

func HashObjectFromReader

func HashObjectFromReader(r io.Reader, oType object.ObjectKind, save bool) (common.Hash, error)

Types

type DirEntry

type DirEntry interface {
	/* TODO: add methods */
	Id() common.Hash
	Type() object.ObjectKind
	Name() string
	Size() int
	Content() []byte
}

type References

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

func GetReferencs

func GetReferencs() *References

func (*References) Head

func (r *References) Head() string

func (*References) LastCommit

func (r *References) LastCommit() (common.Hash, error)

}

func (*References) SaveCommit

func (r *References) SaveCommit(id common.Hash) error

type Repository

type Repository struct {
	Name string
	// relative to the root of workspace
	Path string
}

func GetRepository

func GetRepository() *Repository

func (*Repository) Dump

func (r *Repository) Dump(oid common.Hash, w io.Writer) error

func (*Repository) Get

func (r *Repository) Get(oid common.Hash) (*object.GitObject, error)

Get GitObject from Repository, return nil and error if oid is invalide

func (*Repository) GetAsBlob

func (r *Repository) GetAsBlob(oid common.Hash) (*object.Blob, error)

func (*Repository) GetAsTree

func (r *Repository) GetAsTree(oid common.Hash) (*object.Tree, error)

func (*Repository) InitRepository

func (r *Repository) InitRepository(w io.Writer, root string) error

Init Git Repository in the path. Default, root == "."

func (*Repository) LoadTrees

func (r *Repository) LoadTrees(rootId common.Hash) (*object.Tree, error)

Load multiple Trees led by rootId from repository

func (*Repository) ObjectsPath

func (r *Repository) ObjectsPath() string

func (*Repository) Put

func (r *Repository) Put(g *object.GitObject) error

type StagingArea

type StagingArea struct {
	index.Index
	// contains filtered or unexported fields
}

func GetStagingArea

func GetStagingArea() *StagingArea

func (*StagingArea) Dump

func (s *StagingArea) Dump(w io.Writer)

func (*StagingArea) Load

func (s *StagingArea) Load()

func (*StagingArea) ReadTree

func (s *StagingArea) ReadTree(treeId common.Hash, prefix string, eraseOriginal bool) error

Reads tree information into the index

func (*StagingArea) Save

func (s *StagingArea) Save() error

func (*StagingArea) Stage

func (s *StagingArea) Stage(paths []string) error

func (*StagingArea) Unstage

func (s *StagingArea) Unstage(paths []string, recursive bool)

func (*StagingArea) UpdateIndex

func (s *StagingArea) UpdateIndex(path string)

UpdateIndexEntry add or replace IndexEntry identified by path, and Invalidate all entries in TreeCache covered by path

func (*StagingArea) UpdateIndexFromCache

func (s *StagingArea) UpdateIndexFromCache(oid common.Hash, path string, mode common.FileMode)

func (*StagingArea) UpdateIndexRemove

func (s *StagingArea) UpdateIndexRemove(path string)

If a specified file is in the index but is missing then it’s removed. Default behavior is to ignore removed file.

func (*StagingArea) WriteTree

func (s *StagingArea) WriteTree() (common.Hash, error)

read .git/index file and using files to build and save trees

type VirtualFileSystem

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

func (*VirtualFileSystem) Add

func (fs *VirtualFileSystem) Add(path string)

func (*VirtualFileSystem) Mount

func (fs *VirtualFileSystem) Mount(root string)

func (*VirtualFileSystem) Unmount

func (fs *VirtualFileSystem) Unmount()

type WorkingArea

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

type Workspace

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

func GetWorkspace

func GetWorkspace() (*Workspace, error)

func (*Workspace) InitWorkspace

func (ws *Workspace) InitWorkspace(w io.Writer, root string)

TODO: log and return err

Directories

Path Synopsis
internal
don't do go generate ./...
don't do go generate ./...

Jump to

Keyboard shortcuts

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