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>2022-07-13 10:57:20 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2022-07-13 14:51:13 +0300
commit4dffa03e1e9cec90bd8a214f9a078b26a8057613 (patch)
treefa033f17714dd34d9cb862513bc2432e25997043
parent1811604aa92822c506818882fad39e37947b55ec (diff)
objectpool: Move constant for object pool reference namespaces
Object pools have their references in `refs/remotes/origin` as compared to using their own reference namespace. We require this constant in the housekeeping package to fix our usage of delta islands when repacking object pools. Move the constant into the `git` package and make it public.
-rw-r--r--internal/git/objectpool/fetch.go8
-rw-r--r--internal/git/reference.go4
2 files changed, 7 insertions, 5 deletions
diff --git a/internal/git/objectpool/fetch.go b/internal/git/objectpool/fetch.go
index 3f05df31a..33f96731c 100644
--- a/internal/git/objectpool/fetch.go
+++ b/internal/git/objectpool/fetch.go
@@ -20,8 +20,6 @@ import (
"gitlab.com/gitlab-org/gitaly/v15/internal/git/updateref"
)
-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 *localrepo.Repo) error {
if err := o.Init(ctx); err != nil {
@@ -41,7 +39,7 @@ func (o *ObjectPool) FetchFromOrigin(ctx context.Context, origin *localrepo.Repo
return fmt.Errorf("computing stats before fetch: %w", err)
}
- refSpec := fmt.Sprintf("+refs/*:%s/*", sourceRefNamespace)
+ refSpec := fmt.Sprintf("+refs/*:%s/*", git.ObjectPoolRefNamespace)
var stderr bytes.Buffer
if err := o.Repo.ExecAndWait(ctx,
git.SubCmd{
@@ -143,8 +141,8 @@ func (o *ObjectPool) rescueDanglingObjects(ctx context.Context) error {
func (o *ObjectPool) repackPool(ctx context.Context, pool repository.GitRepo) error {
config := []git.ConfigPair{
- {Key: "pack.island", Value: sourceRefNamespace + "/he(a)ds"},
- {Key: "pack.island", Value: sourceRefNamespace + "/t(a)gs"},
+ {Key: "pack.island", Value: git.ObjectPoolRefNamespace + "/he(a)ds"},
+ {Key: "pack.island", Value: git.ObjectPoolRefNamespace + "/t(a)gs"},
{Key: "pack.islandCore", Value: "a"},
{Key: "pack.writeBitmapHashCache", Value: "true"},
}
diff --git a/internal/git/reference.go b/internal/git/reference.go
index 186bb89bb..c63230b06 100644
--- a/internal/git/reference.go
+++ b/internal/git/reference.go
@@ -19,6 +19,10 @@ var InternalRefPrefixes = [...]string{
"refs/tmp/",
}
+// ObjectPoolRefNamespace is the namespace used for the references of the primary pool member part
+// of an object pool.
+const ObjectPoolRefNamespace = "refs/remotes/origin"
+
// Revision represents anything that resolves to either a commit, multiple
// commits or to an object different than a commit. This could be e.g.
// "master", "master^{commit}", an object hash or similar. See gitrevisions(1)