Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultBranch(branch string) string
- func NormalizePath(value string) (string, error)
- func RefOrDefault(ref, branch string) string
- func ValidateCommitMetadata(message string, author CommitAuthor) error
- func ValidateUserPath(value string) (string, error)
- type CommitAuthor
- type CommitOptions
- type FileOperation
- type Provider
- type Repository
- type RepositoryOptions
Constants ¶
View Source
const ( CodeStorageProvider = "codestorage" SuperGitProvider = "supergit" )
* Two available git storage providers: * - codestorage - https://code.storage * - supergit - https://github.com/superplanehq/supergit
View Source
const ReservedSuperPlanePath = ".superplane"
* Users should not be able to create files in this directory. * I am not really sure we need this protection, but it's better * to start being restrictive and open up later on, than the other way around.
Variables ¶
View Source
var ( ErrInvalidPath = errors.New("invalid file path") ErrInvalidRepositoryID = errors.New("invalid repository path") ErrReservedPath = errors.New("path is reserved for SuperPlane") ErrInvalidCommit = errors.New("invalid commit") ErrExpectedHeadMismatch = errors.New("expected head sha does not match current branch head") )
Functions ¶
func DefaultBranch ¶
func NormalizePath ¶
func RefOrDefault ¶
func ValidateCommitMetadata ¶
func ValidateCommitMetadata(message string, author CommitAuthor) error
func ValidateUserPath ¶
Types ¶
type CommitAuthor ¶
type CommitOptions ¶
type CommitOptions struct {
Branch string
BaseBranch string
ExpectedHeadSHA string
Message string
Author CommitAuthor
Operations []FileOperation
}
func InitialRepositoryCommitOptions ¶
func InitialRepositoryCommitOptions(branch string) CommitOptions
type FileOperation ¶
func ValidateCommitOperations ¶
func ValidateCommitOperations(operations []FileOperation) ([]FileOperation, error)
type Provider ¶
type Provider interface {
//
// The unique identifier of the provider.
//
Name() string
//
// Get the provider specific repository identifier,
// Allows providers to define how they map metadata about a repository,
// to its identifier.
//
GetRepositoryID(options RepositoryOptions) string
//
// Repository management methods.
//
CreateRepository(ctx context.Context, repoID string) (*Repository, error)
DeleteRepository(ctx context.Context, repoID string) error
//
// File management methods
//
ListFiles(ctx context.Context, repoID string) ([]string, error)
GetFile(ctx context.Context, repoID string, path string) (io.ReadCloser, error)
Commit(ctx context.Context, repoID string, options CommitOptions) (string, error)
Head(ctx context.Context, repoID string) (string, error)
}
type Repository ¶
type Repository struct {
ID string
}
Click to show internal directories.
Click to hide internal directories.