gitrepo

package
v1.22.6 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RepositoryContextKey = &contextKey{"repository"}

RepositoryContextKey is a context key. It is used with context.Value() to get the current Repository for the context

Functions

func GetBranchCommitID

func GetBranchCommitID(ctx context.Context, repo Repository, branch string) (string, error)

func GetBranchesByPath

func GetBranchesByPath(ctx context.Context, repo Repository, skip, limit int) ([]*git.Branch, int, error)

GetBranchesByPath returns a branch by its path if limit = 0 it will not limit

func GetDefaultBranch

func GetDefaultBranch(ctx context.Context, repo Repository) (string, error)

GetDefaultBranch gets default branch of repository.

func GetWikiDefaultBranch

func GetWikiDefaultBranch(ctx context.Context, repo Repository) (string, error)

func OpenRepository

func OpenRepository(ctx context.Context, repo Repository) (*git.Repository, error)

OpenRepository opens the repository at the given relative path with the provided context.

func OpenWikiRepository

func OpenWikiRepository(ctx context.Context, repo Repository) (*git.Repository, error)

func RepositoryFromContextOrOpen

func RepositoryFromContextOrOpen(ctx context.Context, repo Repository) (*git.Repository, io.Closer, error)

RepositoryFromContextOrOpen attempts to get the repository from the context or just opens it

func RepositoryFromContextOrOpenPath

func RepositoryFromContextOrOpenPath(ctx context.Context, path string) (*git.Repository, io.Closer, error)

RepositoryFromContextOrOpenPath attempts to get the repository from the context or just opens it Deprecated: Use RepositoryFromContextOrOpen instead

func SetDefaultBranch

func SetDefaultBranch(ctx context.Context, repo Repository, name string) error

SetDefaultBranch sets default branch of repository.

func WalkReferences

func WalkReferences(ctx context.Context, repo Repository, walkfn func(sha1, refname string) error) (int, error)

WalkReferences walks all the references from the repository

Types

type Repository

type Repository interface {
	GetName() string
	GetOwnerName() string
}

Jump to

Keyboard shortcuts

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