core

package
v0.0.0-...-db8c36f Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFileNotFound = errors.New("File not found")
)
View Source
var (
	ErrRefNotFound = errors.New("Ref not found")
)

Functions

func GetBlob

func GetBlob(ref NamedReference, path string) ([]byte, error)

func GetDiff

func GetDiff(ref NamedReference) (object.FileStats, error)

func GetLastCommit

func GetLastCommit(ref NamedReference, paths ...string) (*object.Commit, error)

func GetLog

func GetLog(ref NamedReference, nextRef NamedReference) ([]*object.Commit, error)

func MakeTestRepository

func MakeTestRepository(t *testing.T) *git.Repository

MakeTestRepository returns an in-memory repository for testing

Types

type NamedReference

type NamedReference struct {
	Repository *git.Repository
	Name       string
	Kind       string
	Commit     *object.Commit
}

func GetBranchRef

func GetBranchRef(g *git.Repository, ref string) (NamedReference, error)

func GetCommitRef

func GetCommitRef(g *git.Repository, ref string) (NamedReference, error)

func GetDefaultBranch

func GetDefaultBranch(g *git.Repository) (NamedReference, error)

func GetNamedRef

func GetNamedRef(g *git.Repository, ref string) (NamedReference, error)

func GetTagRef

func GetTagRef(g *git.Repository, ref string) (NamedReference, error)

func (NamedReference) Hash

func (ref NamedReference) Hash() plumbing.Hash

func (NamedReference) Invalid

func (ref NamedReference) Invalid() bool

type RepoConfig

type RepoConfig struct {
	Name        string
	Path        string
	Description string
	InMemory    *git.Repository
}

func (RepoConfig) Open

func (rc RepoConfig) Open() (*git.Repository, error)

type RepoMap

type RepoMap map[string]RepoConfig

func MakeTestRepositories

func MakeTestRepositories(t *testing.T) RepoMap

type SummaryData

type SummaryData struct {
	NumCommits      int
	NumBranches     int
	NumTags         int
	NumFiles        int
	NumContributors int
}

func GetSummary

func GetSummary(ref NamedReference) (SummaryData, error)

type TreeData

type TreeData struct {
	Files []string
	Dirs  []string
}

func GetTree

func GetTree(ref NamedReference, path string) (TreeData, error)

Jump to

Keyboard shortcuts

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