Documentation ¶
Index ¶
- Variables
- func GetDefaultBranch(repository *domain.GitRepository) (string, error)
- func HasCommitsBetween(repository *domain.GitRepository, rootBranch, headBranch string) (bool, error)
- type ManagedGitRepo
- type RepositoryStore
- func (s *RepositoryStore) Add(repository *domain.GitRepository) error
- func (s *RepositoryStore) Checkout(repository *domain.GitRepository) error
- func (s *RepositoryStore) Clone(repository *domain.GitRepository) error
- func (s *RepositoryStore) Commit(repository *domain.GitRepository, options domain.CommitOptions) error
- func (s *RepositoryStore) Diff(repository *domain.GitRepository, options domain.DiffOptions) (string, error)
- func (s *RepositoryStore) Fetch(repository *domain.GitRepository) error
- func (s *RepositoryStore) FetchGitRepositories() ([]*domain.GitRepository, error)
- func (s *RepositoryStore) IsDirty(repository *domain.GitRepository) bool
- func (s *RepositoryStore) Pull(repository *domain.GitRepository) error
- func (s *RepositoryStore) Push(repository *domain.GitRepository, options domain.PushOptions) error
- func (s *RepositoryStore) Reset(repository *domain.GitRepository) error
- type RepositoryStoreInstrumentation
- type StoreConfig
- type TestRepositoryStore
- func (s *TestRepositoryStore) Add(_ *domain.GitRepository) error
- func (s *TestRepositoryStore) Checkout(_ *domain.GitRepository) error
- func (s *TestRepositoryStore) Clone(_ *domain.GitRepository) error
- func (s *TestRepositoryStore) Commit(_ *domain.GitRepository, _ domain.CommitOptions) error
- func (s *TestRepositoryStore) CopySyncFile(repository *domain.GitRepository) error
- func (s *TestRepositoryStore) Diff(repository *domain.GitRepository, _ domain.DiffOptions) (string, error)
- func (s *TestRepositoryStore) Fetch(_ *domain.GitRepository) error
- func (s *TestRepositoryStore) FetchGitRepositories() ([]*domain.GitRepository, error)
- func (s *TestRepositoryStore) Pull(_ *domain.GitRepository) error
- func (s *TestRepositoryStore) Push(_ *domain.GitRepository, _ domain.PushOptions) error
- func (s *TestRepositoryStore) Reset(_ *domain.GitRepository) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotSupported = fmt.Errorf("not supported")
ErrNotSupported indicates that a method is not supported.
var GitBinary = "git"
Functions ¶
func GetDefaultBranch ¶
func GetDefaultBranch(repository *domain.GitRepository) (string, error)
GetDefaultBranch returns the name of the default branch in origin. Returns an error if either Git command failed or if no default branch could be detected.
func HasCommitsBetween ¶
func HasCommitsBetween(repository *domain.GitRepository, rootBranch, headBranch string) (bool, error)
HasCommitsBetween returns true if there are commits in the given revision range. If headBranch is empty, "HEAD" is used. Returns ErrInvalidArgument if rootBranch is empty. Returns errors in all other Git failures.
Types ¶
type ManagedGitRepo ¶
type ManagedGitRepo struct {
Name string
}
ManagedGitRepo is the representation of the managed git repos in the config file.
type RepositoryStore ¶
type RepositoryStore struct { StoreConfig // contains filtered or unexported fields }
func NewRepositoryStore ¶
func NewRepositoryStore(instrumentation *RepositoryStoreInstrumentation) *RepositoryStore
func (*RepositoryStore) Add ¶
func (s *RepositoryStore) Add(repository *domain.GitRepository) error
func (*RepositoryStore) Checkout ¶
func (s *RepositoryStore) Checkout(repository *domain.GitRepository) error
func (*RepositoryStore) Clone ¶
func (s *RepositoryStore) Clone(repository *domain.GitRepository) error
func (*RepositoryStore) Commit ¶
func (s *RepositoryStore) Commit(repository *domain.GitRepository, options domain.CommitOptions) error
func (*RepositoryStore) Diff ¶
func (s *RepositoryStore) Diff(repository *domain.GitRepository, options domain.DiffOptions) (string, error)
func (*RepositoryStore) Fetch ¶
func (s *RepositoryStore) Fetch(repository *domain.GitRepository) error
func (*RepositoryStore) FetchGitRepositories ¶
func (s *RepositoryStore) FetchGitRepositories() ([]*domain.GitRepository, error)
func (*RepositoryStore) IsDirty ¶
func (s *RepositoryStore) IsDirty(repository *domain.GitRepository) bool
func (*RepositoryStore) Pull ¶
func (s *RepositoryStore) Pull(repository *domain.GitRepository) error
func (*RepositoryStore) Push ¶
func (s *RepositoryStore) Push(repository *domain.GitRepository, options domain.PushOptions) error
func (*RepositoryStore) Reset ¶
func (s *RepositoryStore) Reset(repository *domain.GitRepository) error
type RepositoryStoreInstrumentation ¶
type RepositoryStoreInstrumentation struct {
// contains filtered or unexported fields
}
func NewRepositoryStoreInstrumentation ¶
func NewRepositoryStoreInstrumentation(factory logging.LoggerFactory) *RepositoryStoreInstrumentation
type StoreConfig ¶
type TestRepositoryStore ¶
type TestRepositoryStore struct { StoreConfig // TestOutputRootDir is the root dir where the test artifacts are rendered per repository. // This is used for comparing the diff. TestOutputRootDir string // contains filtered or unexported fields }
TestRepositoryStore implements domain.GitRepositoryStore but doesn't actually use or interact with Git repositories. Instead, the purpose is to "fake" Git repositories so that they can be used for testing templates.
func NewTestRepositoryStore ¶
func NewTestRepositoryStore(instrumentation *RepositoryStoreInstrumentation) *TestRepositoryStore
NewTestRepositoryStore creates a new TestRepositoryStore.
func (*TestRepositoryStore) Add ¶
func (s *TestRepositoryStore) Add(_ *domain.GitRepository) error
Add returns ErrNotSupported.
func (*TestRepositoryStore) Checkout ¶
func (s *TestRepositoryStore) Checkout(_ *domain.GitRepository) error
Checkout returns ErrNotSupported.
func (*TestRepositoryStore) Clone ¶
func (s *TestRepositoryStore) Clone(_ *domain.GitRepository) error
Clone returns ErrNotSupported.
func (*TestRepositoryStore) Commit ¶
func (s *TestRepositoryStore) Commit(_ *domain.GitRepository, _ domain.CommitOptions) error
Commit returns ErrNotSupported.
func (*TestRepositoryStore) CopySyncFile ¶
func (s *TestRepositoryStore) CopySyncFile(repository *domain.GitRepository) error
CopySyncFile copies the sync file from StoreConfig.ParentDir to TestRepositoryStore.TestOutputRootDir. It returns nil if the sync file doesn't exist.
func (*TestRepositoryStore) Diff ¶
func (s *TestRepositoryStore) Diff(repository *domain.GitRepository, _ domain.DiffOptions) (string, error)
Diff implements domain.GitRepositoryStore. Since this implementation is meant for testing local fake repositories, the diff will be computed against the files stored in TestRepositoryStore.TestOutputRootDir. The files in the repository's RootDir are the expected files, where "---" is the expected file content, and "+++" the actual content.
func (*TestRepositoryStore) Fetch ¶
func (s *TestRepositoryStore) Fetch(_ *domain.GitRepository) error
Fetch returns ErrNotSupported.
func (*TestRepositoryStore) FetchGitRepositories ¶
func (s *TestRepositoryStore) FetchGitRepositories() ([]*domain.GitRepository, error)
FetchGitRepositories implements domain.GitRepositoryStore.
func (*TestRepositoryStore) Pull ¶
func (s *TestRepositoryStore) Pull(_ *domain.GitRepository) error
Pull returns ErrNotSupported.
func (*TestRepositoryStore) Push ¶
func (s *TestRepositoryStore) Push(_ *domain.GitRepository, _ domain.PushOptions) error
Push returns ErrNotSupported.
func (*TestRepositoryStore) Reset ¶
func (s *TestRepositoryStore) Reset(_ *domain.GitRepository) error
Reset returns ErrNotSupported.