Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Okstad <pokstad@gitlab.com>2020-10-06 09:24:41 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2020-10-14 11:57:35 +0300
commit4a012d837535e128fe32593e3ddbfba541d1a88c (patch)
tree867e789e9f1d5d8d746f137c14479ddf75e84fbb
parent9d0ee3ce409b0abd364135d7334fb0873f7bfc8b (diff)
Add unimplemented Repository for convenience
-rw-r--r--internal/git/repository.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/internal/git/repository.go b/internal/git/repository.go
index ab0dce686..041266fa9 100644
--- a/internal/git/repository.go
+++ b/internal/git/repository.go
@@ -74,6 +74,44 @@ type Repository interface {
CatFile(ctx context.Context, oid string) ([]byte, error)
}
+// ErrUnimplemented indicates the repository abstraction does not yet implement
+// a specific behavior
+var ErrUnimplemented = errors.New("behavior not implemented yet")
+
+// UnimplementedRepo satisfies the Repository interface to reduce friction in
+// writing new Repository implementations
+type UnimplementedRepo struct{}
+
+func (UnimplementedRepo) ResolveRefish(ctx context.Context, ref string) (string, error) {
+ return "", ErrUnimplemented
+}
+
+func (UnimplementedRepo) ContainsRef(ctx context.Context, ref string) (bool, error) {
+ return false, ErrUnimplemented
+}
+
+func (UnimplementedRepo) GetReference(ctx context.Context, ref string) (Reference, error) {
+ return Reference{}, ErrUnimplemented
+}
+
+func (UnimplementedRepo) GetReferences(ctx context.Context, pattern string) ([]Reference, error) {
+ return nil, ErrUnimplemented
+}
+
+func (UnimplementedRepo) GetBranch(ctx context.Context, branch string) (Reference, error) {
+ return Reference{}, ErrUnimplemented
+}
+
+func (UnimplementedRepo) GetBranches(ctx context.Context) ([]Reference, error) {
+ return nil, ErrUnimplemented
+}
+
+func (UnimplementedRepo) UpdateRef(ctx context.Context, reference, newrev, oldrev string) error {
+ return ErrUnimplemented
+}
+
+var _ Repository = UnimplementedRepo{} // compile time assertion
+
// localRepository represents a local Git repository.
type localRepository struct {
repo repository.GitRepo