Inspect changes in Gitaly 0e78015ff2052203845e049be8b3395bac782554
Upstream merge commit ad4fee537184 changes Gitaly server version from 38aa3f1b70406c72e9ab26389cbdecbdd3218a0a to 0e78015ff2052203845e049be8b3395bac782554, with changes in protocol or one of the source subtrees currently under watch.
To further inspect, go to an up to date Gitaly source clone and run
diff 38aa3f1b70406c72e9ab26389cbdecbdd3218a0a..0e78015ff2052203845e049be8b3395bac782554 -- proto/*.proto internal/backup
. Here is a preview, truncated at 500 lines:
diff --git a/internal/backup/backup.go b/internal/backup/backup.go
index dfacafeac..b2a594992 100644
--- a/internal/backup/backup.go
+++ b/internal/backup/backup.go
@@ -41,6 +41,8 @@ type Sink interface {
type Backup struct {
// Steps are the ordered list of steps required to restore this backup
Steps []Step
+ // ObjectFormat is the name of the object hash used by the repository.
+ ObjectFormat string
}
// Step represents an incremental step that makes up a complete backup for a repository
@@ -90,7 +92,7 @@ type Repository interface {
// repository cannot be found.
Remove(ctx context.Context) error
// Create creates the repository.
- Create(ctx context.Context) error
+ Create(ctx context.Context, hash git.ObjectHash) error
// FetchBundle fetches references from a bundle. Refs will be mirrored to
// the repository.
FetchBundle(ctx context.Context, reader io.Reader) error
@@ -262,7 +264,12 @@ func (mgr *Manager) Restore(ctx context.Context, req *RestoreRequest) error {
}
}
- if err := repo.Create(ctx); err != nil {
+ hash, err := git.ObjectHashByFormat(backup.ObjectFormat)
+ if err != nil {
+ return fmt.Errorf("manager: %w", err)
+ }
+
+ if err := repo.Create(ctx, hash); err != nil {
return fmt.Errorf("manager: %w", err)
}
diff --git a/internal/backup/locator.go b/internal/backup/locator.go
index e4f023fed..6d1419489 100644
--- a/internal/backup/locator.go
+++ b/internal/backup/locator.go
@@ -9,6 +9,7 @@ import (
"strconv"
"strings"
+ "gitlab.com/gitlab-org/gitaly/v16/internal/git"
"gitlab.com/gitlab-org/gitaly/v16/internal/helper/text"
"gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb"
)
@@ -47,6 +48,7 @@ func (l LegacyLocator) FindLatest(ctx context.Context, repo *gitalypb.Repository
Steps: []Step{
*l.newFull(repo),
},
+ ObjectFormat: git.ObjectHashSHA1.Format,
}, nil
}
@@ -194,7 +196,9 @@ func (l PointerLocator) find(ctx context.Context, repo *gitalypb.Repository, bac
return nil, fmt.Errorf("find: determine increment ID: %w", err)
}
- var backup Backup
+ backup := Backup{
+ ObjectFormat: git.ObjectHashSHA1.Format,
+ }
for i := 1; i <= max; i++ {
var previousRefPath string
diff --git a/internal/backup/locator_test.go b/internal/backup/locator_test.go
index eadcbda99..bb30379fd 100644
--- a/internal/backup/locator_test.go
+++ b/internal/backup/locator_test.go
@@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "gitlab.com/gitlab-org/gitaly/v16/internal/git"
"gitlab.com/gitlab-org/gitaly/v16/internal/git/gittest"
"gitlab.com/gitlab-org/gitaly/v16/internal/helper/perm"
"gitlab.com/gitlab-org/gitaly/v16/internal/testhelper"
@@ -50,6 +51,7 @@ func TestLegacyLocator(t *testing.T) {
t.Parallel()
expected := &Backup{
+ ObjectFormat: git.ObjectHashSHA1.Format,
Steps: []Step{
{
SkippableOnNotFound: true,
@@ -196,6 +198,7 @@ func TestPointerLocator(t *testing.T) {
require.NoError(t, os.WriteFile(filepath.Join(backupPath, repo.RelativePath, "LATEST"), []byte(backupID), perm.SharedFile))
require.NoError(t, os.WriteFile(filepath.Join(backupPath, repo.RelativePath, backupID, "LATEST"), []byte("003"), perm.SharedFile))
expected := &Backup{
+ ObjectFormat: git.ObjectHashSHA1.Format,
Steps: []Step{
{
BundlePath: filepath.Join(repo.RelativePath, backupID, "001.bundle"),
@@ -232,6 +235,7 @@ func TestPointerLocator(t *testing.T) {
}
expectedFallback := &Backup{
+ ObjectFormat: git.ObjectHashSHA1.Format,
Steps: []Step{
{
SkippableOnNotFound: true,
@@ -250,6 +254,7 @@ func TestPointerLocator(t *testing.T) {
require.NoError(t, os.WriteFile(filepath.Join(backupPath, repo.RelativePath, "LATEST"), []byte(backupID), perm.SharedFile))
require.NoError(t, os.WriteFile(filepath.Join(backupPath, repo.RelativePath, backupID, "LATEST"), []byte("001"), perm.SharedFile))
expected := &Backup{
+ ObjectFormat: git.ObjectHashSHA1.Format,
Steps: []Step{
{
BundlePath: filepath.Join(repo.RelativePath, backupID, "001.bundle"),
@@ -327,6 +332,7 @@ func TestPointerLocator(t *testing.T) {
require.NoError(t, os.MkdirAll(filepath.Join(backupPath, repo.RelativePath, backupID), perm.SharedDir))
require.NoError(t, os.WriteFile(filepath.Join(backupPath, repo.RelativePath, backupID, "LATEST"), []byte("003"), perm.SharedFile))
expected := &Backup{
+ ObjectFormat: git.ObjectHashSHA1.Format,
Steps: []Step{
{
BundlePath: filepath.Join(repo.RelativePath, backupID, "001.bundle"),
diff --git a/internal/backup/repository.go b/internal/backup/repository.go
index 0ebd5b445..12762d496 100644
--- a/internal/backup/repository.go
+++ b/internal/backup/repository.go
@@ -175,9 +175,12 @@ func (rr *remoteRepository) Remove(ctx context.Context) error {
}
// Create creates the repository.
-func (rr *remoteRepository) Create(ctx context.Context) error {
+func (rr *remoteRepository) Create(ctx context.Context, hash git.ObjectHash) error {
repoClient := rr.newRepoClient()
- if _, err := repoClient.CreateRepository(ctx, &gitalypb.CreateRepositoryRequest{Repository: rr.repo}); err != nil {
+ if _, err := repoClient.CreateRepository(ctx, &gitalypb.CreateRepositoryRequest{
+ Repository: rr.repo,
+ ObjectFormat: hash.ProtoFormat,
+ }); err != nil {
return fmt.Errorf("remote repository: create: %w", err)
}
return nil
@@ -328,7 +331,7 @@ func (r *localRepository) Remove(ctx context.Context) error {
}
// Create creates the repository.
-func (r *localRepository) Create(ctx context.Context) error {
+func (r *localRepository) Create(ctx context.Context, hash git.ObjectHash) error {
if err := repoutil.Create(
ctx,
r.locator,
@@ -337,6 +340,7 @@ func (r *localRepository) Create(ctx context.Context) error {
r.repoCounter,
r.repo,
func(repository *gitalypb.Repository) error { return nil },
+ repoutil.WithObjectHash(hash),
); err != nil {
return fmt.Errorf("local repository: create: %w", err)
}
A merge request may have already been submitted, check that on [merge commit commit](ad4fee537184, as usually changes in Gitaly are not breaking, compliance becoming mandatory in the following development cycles.