Documentation
¶
Index ¶
- func CheckDelegateHooks(_ context.Context, repo Repository) ([]string, error)
- func CreateDelegateHooks(_ context.Context, repo Repository) (err error)
- func DeleteRepository(ctx context.Context, repo Repository) error
- func GetBranchCommitID(ctx context.Context, repo Repository, branch string) (string, error)
- func GetBranchesByPath(ctx context.Context, repo Repository, skip, limit int) ([]string, int, error)
- func GetDefaultBranch(ctx context.Context, repo Repository) (string, error)
- func IsBranchExist(ctx context.Context, repo Repository, name string) bool
- func IsReferenceExist(ctx context.Context, repo Repository, name string) bool
- func IsRepositoryExist(ctx context.Context, repo Repository) (bool, error)
- func IsTagExist(ctx context.Context, repo Repository, name string) bool
- func OpenRepository(ctx context.Context, repo Repository) (*git.Repository, error)
- func RenameRepository(ctx context.Context, repo, newRepo Repository) error
- func RepoGitURL(repo Repository) string
- func RepositoryFromContextOrOpen(ctx context.Context, repo Repository) (*git.Repository, io.Closer, error)
- func RepositoryFromRequestContextOrOpen(ctx reqctx.RequestContext, repo Repository) (*git.Repository, error)
- func SetDefaultBranch(ctx context.Context, repo Repository, name string) error
- func WalkReferences(ctx context.Context, repo Repository, walkfn func(sha1, refname string) error) (int, error)
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDelegateHooks ¶ added in v1.24.0
func CheckDelegateHooks(_ context.Context, repo Repository) ([]string, error)
CheckDelegateHooks checks the hooks scripts for the repo
func CreateDelegateHooks ¶ added in v1.24.0
func CreateDelegateHooks(_ context.Context, repo Repository) (err error)
CreateDelegateHooks creates all the hooks scripts for the repo
func DeleteRepository ¶ added in v1.24.0
func DeleteRepository(ctx context.Context, repo Repository) error
DeleteRepository deletes the repository directory from the disk
func GetBranchCommitID ¶
func GetBranchesByPath ¶
func GetBranchesByPath(ctx context.Context, repo Repository, skip, limit int) ([]string, 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 IsBranchExist ¶ added in v1.24.0
func IsBranchExist(ctx context.Context, repo Repository, name string) bool
IsBranchExist returns true if given branch exists in the repository.
func IsReferenceExist ¶ added in v1.24.0
func IsReferenceExist(ctx context.Context, repo Repository, name string) bool
IsReferenceExist returns true if given reference exists in the repository.
func IsRepositoryExist ¶ added in v1.24.0
func IsRepositoryExist(ctx context.Context, repo Repository) (bool, error)
IsRepositoryExist returns true if the repository directory exists in the disk
func IsTagExist ¶ added in v1.24.0
func IsTagExist(ctx context.Context, repo Repository, name string) bool
IsTagExist returns true if given tag exists in the repository.
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 RenameRepository ¶ added in v1.24.0
func RenameRepository(ctx context.Context, repo, newRepo Repository) error
RenameRepository renames a repository's name on disk
func RepoGitURL ¶ added in v1.23.0
func RepoGitURL(repo Repository) string
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 The caller must call "defer gitRepo.Close()"
func RepositoryFromRequestContextOrOpen ¶ added in v1.24.0
func RepositoryFromRequestContextOrOpen(ctx reqctx.RequestContext, repo Repository) (*git.Repository, error)
RepositoryFromRequestContextOrOpen opens the repository at the given relative path in the provided request context. Caller shouldn't close the git repo manually, the git repo will be automatically closed when the request context is done.
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 {
RelativePath() string // We don't assume how the directory structure of the repository is, so we only need the relative path
}
Repository represents a git repository which stored in a disk