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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-10-18 09:23:33 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-10-25 13:38:52 +0300
commit6ad960b2f7c75e20836fa6b5ce2abaaa4d4076b5 (patch)
tree58ee266a9f05e2e4441d362d7e9be3ad900b17f0
parentffadcf56a504ff667645dd69a03b43cf67bbbb91 (diff)
objectpool: Convert to use in-memory fetches
There is only a single callsite left in our codebase which creates on-disk remotes, which is the `FetchIntoObjectPool` RPC. We do not need this remote for anything though, and we have in the past made the move to only ever use in-memory remotes. Convert the implementation to use in-memory remotes.
-rw-r--r--internal/git/objectpool/fetch.go24
1 files changed, 2 insertions, 22 deletions
diff --git a/internal/git/objectpool/fetch.go b/internal/git/objectpool/fetch.go
index 45fc92de3..bcebab764 100644
--- a/internal/git/objectpool/fetch.go
+++ b/internal/git/objectpool/fetch.go
@@ -22,10 +22,7 @@ import (
"gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb"
)
-const (
- sourceRemote = "origin"
- sourceRefNamespace = "refs/remotes/" + sourceRemote
-)
+const sourceRefNamespace = "refs/remotes/origin"
// FetchFromOrigin initializes the pool and fetches the objects from its origin repository
func (o *ObjectPool) FetchFromOrigin(ctx context.Context, origin *gitalypb.Repository) error {
@@ -42,23 +39,6 @@ func (o *ObjectPool) FetchFromOrigin(ctx context.Context, origin *gitalypb.Repos
return err
}
- remote := o.poolRepo.Remote()
-
- remoteExists, err := remote.Exists(ctx, sourceRemote)
- if err != nil {
- return err
- }
-
- if remoteExists {
- if err := remote.SetURL(ctx, sourceRemote, originPath, git.SetURLOpts{}); err != nil {
- return err
- }
- } else {
- if err := remote.Add(ctx, sourceRemote, originPath, git.RemoteAddOpts{}); err != nil {
- return err
- }
- }
-
if err := o.logStats(ctx, "before fetch"); err != nil {
return err
}
@@ -72,7 +52,7 @@ func (o *ObjectPool) FetchFromOrigin(ctx context.Context, origin *gitalypb.Repos
git.Flag{Name: "--quiet"},
git.Flag{Name: "--atomic"},
},
- Args: []string{sourceRemote, refSpec},
+ Args: []string{originPath, refSpec},
},
git.WithRefTxHook(ctx, o.poolRepo, o.cfg),
git.WithStderr(&stderr),