diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-13 10:57:20 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-15 09:57:06 +0300 |
commit | 620ccf7755c202098fe053b1663103dfe91a1392 (patch) | |
tree | 2c19c2a96dda14a579c9c4814ec863ee70706f75 | |
parent | a4a80a6ec53b44cc8408e0546dcfb122e1c33c27 (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.go | 8 | ||||
-rw-r--r-- | internal/git/reference.go | 4 |
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) |