diff options
author | James Fargher <jfargher@gitlab.com> | 2023-05-10 04:58:38 +0300 |
---|---|---|
committer | James Fargher <jfargher@gitlab.com> | 2023-05-16 05:15:23 +0300 |
commit | 48e2fc87e44209bc9550c0c1a17dfecd7e3f71b5 (patch) | |
tree | ef3cededb2dd778c0dc77562a34e406d7421a956 | |
parent | 3169de44212b7c158f405c13867817135be3621d (diff) |
repoutil: Accept GitRepo interface
This interface will accept both gitalypb.Repository and localrepo.Repo.
This means we can reuse the repoutil functions in a few more situations.
Like server-side backups.
-rw-r--r-- | internal/gitaly/repoutil/create.go | 3 | ||||
-rw-r--r-- | internal/gitaly/repoutil/lock.go | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/internal/gitaly/repoutil/create.go b/internal/gitaly/repoutil/create.go index f4396697c..07dedc61a 100644 --- a/internal/gitaly/repoutil/create.go +++ b/internal/gitaly/repoutil/create.go @@ -11,6 +11,7 @@ import ( "time" "gitlab.com/gitlab-org/gitaly/v16/internal/git" + "gitlab.com/gitlab-org/gitaly/v16/internal/git/repository" "gitlab.com/gitlab-org/gitaly/v16/internal/git/stats" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/transaction" @@ -65,7 +66,7 @@ func Create( locator storage.Locator, gitCmdFactory git.CommandFactory, txManager transaction.Manager, - repository *gitalypb.Repository, + repository repository.GitRepo, seedRepository func(repository *gitalypb.Repository) error, options ...CreateOption, ) error { diff --git a/internal/gitaly/repoutil/lock.go b/internal/gitaly/repoutil/lock.go index c11fc73fd..a3235ce18 100644 --- a/internal/gitaly/repoutil/lock.go +++ b/internal/gitaly/repoutil/lock.go @@ -6,11 +6,11 @@ import ( "path/filepath" "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus" + "gitlab.com/gitlab-org/gitaly/v16/internal/git/repository" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/storage" "gitlab.com/gitlab-org/gitaly/v16/internal/helper/perm" "gitlab.com/gitlab-org/gitaly/v16/internal/safe" "gitlab.com/gitlab-org/gitaly/v16/internal/structerr" - "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" ) // Lock attempts to lock the entire repository directory such that only one @@ -20,7 +20,7 @@ import ( // // Returns the error safe.ErrFileAlreadyLocked if the repository is already // locked. -func Lock(ctx context.Context, locator storage.Locator, repository *gitalypb.Repository) (func(), error) { +func Lock(ctx context.Context, locator storage.Locator, repository repository.GitRepo) (func(), error) { path, err := locator.GetPath(repository) if err != nil { return nil, err |