diff options
author | John Cai <jcai@gitlab.com> | 2022-08-02 21:20:35 +0300 |
---|---|---|
committer | John Cai <jcai@gitlab.com> | 2022-08-02 21:20:35 +0300 |
commit | b799d0b98f26e3de2fc408bf2b83eb86fb330858 (patch) | |
tree | 783812662bf79b0edede2d4d3e056b37005bb5bb | |
parent | 072f01c9a020b2b49c222a338349555b2e807384 (diff) | |
parent | ae728915534c37a9e44fad0d78ef936c6abea765 (diff) |
Merge branch 'jc-delete-ref-return-errors' into 'master'
refs: Return structured errors for DeleteRefs
See merge request gitlab-org/gitaly!4554
-rw-r--r-- | internal/git/gittest/command_factory.go | 10 | ||||
-rw-r--r-- | internal/git/updateref/updateref.go | 24 | ||||
-rw-r--r-- | internal/git/updateref/updateref_test.go | 19 | ||||
-rw-r--r-- | internal/gitaly/service/ref/delete_refs.go | 62 | ||||
-rw-r--r-- | internal/gitaly/service/ref/delete_refs_test.go | 103 | ||||
-rw-r--r-- | internal/metadata/featureflag/ff_delete_refs_structured_errors.go | 9 | ||||
-rw-r--r-- | proto/errors.proto | 2 | ||||
-rw-r--r-- | proto/go/gitalypb/errors.pb.go | 105 | ||||
-rw-r--r-- | ruby/proto/gitaly/errors_pb.rb | 1 |
9 files changed, 267 insertions, 68 deletions
diff --git a/internal/git/gittest/command_factory.go b/internal/git/gittest/command_factory.go index 0285a1f9c..25d76f6a6 100644 --- a/internal/git/gittest/command_factory.go +++ b/internal/git/gittest/command_factory.go @@ -1,6 +1,7 @@ package gittest import ( + "context" "testing" "github.com/stretchr/testify/require" @@ -16,3 +17,12 @@ func NewCommandFactory(tb testing.TB, cfg config.Cfg, opts ...git.ExecCommandFac tb.Cleanup(cleanup) return factory } + +// GitSupportsStatusFlushing returns whether or not the current version of Git +// supports status flushing. +//nolint: revive +func GitSupportsStatusFlushing(t *testing.T, ctx context.Context, cfg config.Cfg) bool { + version, err := NewCommandFactory(t, cfg).GitVersion(ctx) + require.NoError(t, err) + return version.FlushesUpdaterefStatus() +} diff --git a/internal/git/updateref/updateref.go b/internal/git/updateref/updateref.go index c8f446720..54461b5fb 100644 --- a/internal/git/updateref/updateref.go +++ b/internal/git/updateref/updateref.go @@ -5,11 +5,22 @@ import ( "bytes" "context" "fmt" + "regexp" "gitlab.com/gitlab-org/gitaly/v15/internal/command" "gitlab.com/gitlab-org/gitaly/v15/internal/git" ) +// ErrAlreadyLocked indicates a reference cannot be locked because another +// process has already locked it. +type ErrAlreadyLocked struct { + Ref string +} + +func (e *ErrAlreadyLocked) Error() string { + return fmt.Sprintf("reference is already locked: %q", e.Ref) +} + // Updater wraps a `git update-ref --stdin` process, presenting an interface // that allows references to be easily updated in bulk. It is not suitable for // concurrent use. @@ -114,11 +125,22 @@ func (u *Updater) Delete(reference git.ReferenceName) error { return u.Update(reference, git.ObjectHashSHA1.ZeroOID.String(), "") } +var refLockedRegex = regexp.MustCompile("cannot lock ref '(.+?)'") + // Prepare prepares the reference transaction by locking all references and determining their // current values. The updates are not yet committed and will be rolled back in case there is no // call to `Commit()`. This call is optional. func (u *Updater) Prepare() error { - return u.setState("prepare") + if err := u.setState("prepare"); err != nil { + matches := refLockedRegex.FindSubmatch([]byte(err.Error())) + if len(matches) > 1 { + return &ErrAlreadyLocked{Ref: string(matches[1])} + } + + return err + } + + return nil } // Commit applies the commands specified in other calls to the Updater diff --git a/internal/git/updateref/updateref_test.go b/internal/git/updateref/updateref_test.go index 0de5f698c..008d6f889 100644 --- a/internal/git/updateref/updateref_test.go +++ b/internal/git/updateref/updateref_test.go @@ -128,7 +128,7 @@ func TestUpdater_concurrentLocking(t *testing.T) { cfg, protoRepo, _ := testcfg.BuildWithRepo(t) ctx := testhelper.Context(t) - if !gitSupportsStatusFlushing(t, ctx, cfg) { + if !gittest.GitSupportsStatusFlushing(t, ctx, cfg) { t.Skip("git does not support flushing yet, which is known to be flaky") } @@ -147,8 +147,11 @@ func TestUpdater_concurrentLocking(t *testing.T) { require.NoError(t, secondUpdater.Update("refs/heads/master", "", commit.Id)) err = secondUpdater.Prepare() - require.Error(t, err) - require.Contains(t, err.Error(), "fatal: prepare: cannot lock ref 'refs/heads/master'") + var errAlreadyLocked *ErrAlreadyLocked + require.ErrorAs(t, err, &errAlreadyLocked) + require.Equal(t, err, &ErrAlreadyLocked{ + Ref: "refs/heads/master", + }) require.NoError(t, firstUpdater.Commit()) } @@ -204,7 +207,7 @@ func TestUpdater_cancel(t *testing.T) { cfg, repo, updater := setupUpdater(t, ctx) - if !gitSupportsStatusFlushing(t, ctx, cfg) { + if !gittest.GitSupportsStatusFlushing(t, ctx, cfg) { t.Skip("git does not support flushing yet, which is known to be flaky") } @@ -267,7 +270,7 @@ func TestUpdater_capturesStderr(t *testing.T) { require.NoError(t, updater.Update(git.ReferenceName(ref), newValue, oldValue)) var expectedErr string - if gitSupportsStatusFlushing(t, ctx, cfg) { + if gittest.GitSupportsStatusFlushing(t, ctx, cfg) { expectedErr = fmt.Sprintf("state update to \"commit\" failed: EOF, stderr: \"fatal: commit: cannot update ref '%s': "+ "trying to write ref '%s' with nonexistent object %s\\n\"", ref, ref, newValue) } else { @@ -280,9 +283,3 @@ func TestUpdater_capturesStderr(t *testing.T) { require.NotNil(t, err) require.Equal(t, err.Error(), expectedErr) } - -func gitSupportsStatusFlushing(t *testing.T, ctx context.Context, cfg config.Cfg) bool { - version, err := gittest.NewCommandFactory(t, cfg).GitVersion(ctx) - require.NoError(t, err) - return version.FlushesUpdaterefStatus() -} diff --git a/internal/gitaly/service/ref/delete_refs.go b/internal/gitaly/service/ref/delete_refs.go index 0e58d8000..f8d7a7f03 100644 --- a/internal/gitaly/service/ref/delete_refs.go +++ b/internal/gitaly/service/ref/delete_refs.go @@ -11,6 +11,7 @@ import ( "gitlab.com/gitlab-org/gitaly/v15/internal/git/updateref" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/transaction" "gitlab.com/gitlab-org/gitaly/v15/internal/helper" + "gitlab.com/gitlab-org/gitaly/v15/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v15/internal/transaction/voting" "gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb" "google.golang.org/grpc/codes" @@ -38,8 +39,41 @@ func (s *server) DeleteRefs(ctx context.Context, in *gitalypb.DeleteRefsRequest) } voteHash := voting.NewVoteHash() + + if featureflag.DeleteRefsStructuredErrors.IsEnabled(ctx) { + var invalidRefnames [][]byte + + for _, ref := range refnames { + if err := git.ValidateRevision([]byte(ref)); err != nil { + invalidRefnames = append(invalidRefnames, []byte(ref)) + } + } + + if len(invalidRefnames) > 0 { + detailedErr, err := helper.ErrWithDetails( + helper.ErrInvalidArgumentf("invalid references"), + &gitalypb.DeleteRefsError{ + Error: &gitalypb.DeleteRefsError_InvalidFormat{ + InvalidFormat: &gitalypb.InvalidRefFormatError{ + Refs: invalidRefnames, + }, + }, + }, + ) + if err != nil { + return nil, helper.ErrInternalf("error details: %w", err) + } + + return nil, detailedErr + } + } + for _, ref := range refnames { if err := updater.Delete(ref); err != nil { + if featureflag.DeleteRefsStructuredErrors.IsEnabled(ctx) { + return nil, helper.ErrInternalf("unable to delete refs: %w", err) + } + return &gitalypb.DeleteRefsResponse{GitError: err.Error()}, nil } @@ -49,6 +83,26 @@ func (s *server) DeleteRefs(ctx context.Context, in *gitalypb.DeleteRefsRequest) } if err := updater.Prepare(); err != nil { + var errAlreadyLocked *updateref.ErrAlreadyLocked + if featureflag.DeleteRefsStructuredErrors.IsEnabled(ctx) && + errors.As(err, &errAlreadyLocked) { + detailedErr, err := helper.ErrWithDetails( + helper.ErrFailedPreconditionf("cannot lock references"), + &gitalypb.DeleteRefsError{ + Error: &gitalypb.DeleteRefsError_ReferencesLocked{ + ReferencesLocked: &gitalypb.ReferencesLockedError{ + Refs: [][]byte{[]byte(errAlreadyLocked.Ref)}, + }, + }, + }, + ) + if err != nil { + return nil, helper.ErrInternalf("error details: %w", err) + } + + return nil, detailedErr + } + return &gitalypb.DeleteRefsResponse{ GitError: fmt.Sprintf("unable to delete refs: %s", err.Error()), }, nil @@ -68,10 +122,10 @@ func (s *server) DeleteRefs(ctx context.Context, in *gitalypb.DeleteRefsRequest) } if err := updater.Commit(); err != nil { - // TODO: We should be able to easily drop this error here and return a real error as - // soon as we always use proper locking semantics in git-update-ref(1). All locking - // issues would be caught when `Prepare()`ing the changes already, so a fail - // afterwards would hint at a real unexpected error. + if featureflag.DeleteRefsStructuredErrors.IsEnabled(ctx) { + return nil, helper.ErrInternalf("unable to commit: %w", err) + } + return &gitalypb.DeleteRefsResponse{GitError: fmt.Sprintf("unable to delete refs: %s", err.Error())}, nil } diff --git a/internal/gitaly/service/ref/delete_refs_test.go b/internal/gitaly/service/ref/delete_refs_test.go index d756ec2ff..4210bae9d 100644 --- a/internal/gitaly/service/ref/delete_refs_test.go +++ b/internal/gitaly/service/ref/delete_refs_test.go @@ -3,17 +3,22 @@ package ref import ( + "context" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "gitlab.com/gitlab-org/gitaly/v15/internal/git" "gitlab.com/gitlab-org/gitaly/v15/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo" + "gitlab.com/gitlab-org/gitaly/v15/internal/git/updateref" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service" hookservice "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service/hook" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/service/repository" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/transaction" + "gitlab.com/gitlab-org/gitaly/v15/internal/helper" "gitlab.com/gitlab-org/gitaly/v15/internal/metadata" + "gitlab.com/gitlab-org/gitaly/v15/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v15/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v15/internal/testhelper/testcfg" "gitlab.com/gitlab-org/gitaly/v15/internal/testhelper/testserver" @@ -25,8 +30,14 @@ import ( func TestDeleteRefs_successful(t *testing.T) { t.Parallel() - ctx := testhelper.Context(t) + testhelper.NewFeatureSets(featureflag.DeleteRefsStructuredErrors).Run( + t, + testDeleteRefSuccessful, + ) +} + +func testDeleteRefSuccessful(t *testing.T, ctx context.Context) { cfg, client := setupRefServiceWithoutRepo(t) testCases := []struct { @@ -82,8 +93,14 @@ func TestDeleteRefs_successful(t *testing.T) { func TestDeleteRefs_transaction(t *testing.T) { t.Parallel() - ctx := testhelper.Context(t) + testhelper.NewFeatureSets(featureflag.DeleteRefsStructuredErrors).Run( + t, + testDeleteRefsTransaction, + ) +} + +func testDeleteRefsTransaction(t *testing.T, ctx context.Context) { cfg := testcfg.Build(t) testcfg.BuildGitalyHooks(t, cfg) @@ -158,19 +175,95 @@ func TestDeleteRefs_transaction(t *testing.T) { func TestDeleteRefs_invalidRefFormat(t *testing.T) { t.Parallel() - ctx := testhelper.Context(t) + testhelper.NewFeatureSets(featureflag.DeleteRefsStructuredErrors).Run( + t, + testDeleteRefsInvalidRefFormat, + ) +} + +func testDeleteRefsInvalidRefFormat(t *testing.T, ctx context.Context) { _, repo, _, client := setupRefService(ctx, t) request := &gitalypb.DeleteRefsRequest{ Repository: repo, - Refs: [][]byte{[]byte(`refs\tails\invalid-ref-format`)}, + Refs: [][]byte{[]byte(`refs invalid-ref-format`)}, } response, err := client.DeleteRefs(ctx, request) + + if featureflag.DeleteRefsStructuredErrors.IsEnabled(ctx) { + require.Nil(t, response) + detailedErr, errGeneratingDetailedErr := helper.ErrWithDetails( + helper.ErrInvalidArgumentf("invalid references"), + &gitalypb.DeleteRefsError{ + Error: &gitalypb.DeleteRefsError_InvalidFormat{ + InvalidFormat: &gitalypb.InvalidRefFormatError{ + Refs: request.Refs, + }, + }, + }) + require.NoError(t, errGeneratingDetailedErr) + testhelper.RequireGrpcError(t, detailedErr, err) + } else { + require.NoError(t, err) + assert.Contains(t, response.GitError, "invalid ref format") + } +} + +func TestDeleteRefs_refLocked(t *testing.T) { + t.Parallel() + + testhelper.NewFeatureSets(featureflag.DeleteRefsStructuredErrors).Run( + t, + testDeleteRefsRefLocked, + ) +} + +func testDeleteRefsRefLocked(t *testing.T, ctx context.Context) { + cfg, repoProto, _, client := setupRefService(ctx, t) + + if !gittest.GitSupportsStatusFlushing(t, ctx, cfg) { + t.Skip("git does not support flushing yet, which is known to be flaky") + } + + request := &gitalypb.DeleteRefsRequest{ + Repository: repoProto, + Refs: [][]byte{[]byte("refs/heads/master")}, + } + + repo := localrepo.NewTestRepo(t, cfg, repoProto) + oldValue, err := repo.ResolveRevision(ctx, git.Revision("refs/heads/master")) + require.NoError(t, err) + + updater, err := updateref.New(ctx, repo) require.NoError(t, err) + require.NoError(t, updater.Update( + git.ReferenceName("refs/heads/master"), + "0b4bc9a49b562e85de7cc9e834518ea6828729b9", + oldValue.String(), + )) + require.NoError(t, updater.Prepare()) - assert.Contains(t, response.GitError, "unable to delete refs") + response, err := client.DeleteRefs(ctx, request) + + if featureflag.DeleteRefsStructuredErrors.IsEnabled(ctx) { + require.Nil(t, response) + detailedErr, errGeneratingDetailedErr := helper.ErrWithDetails( + helper.ErrFailedPreconditionf("cannot lock references"), + &gitalypb.DeleteRefsError{ + Error: &gitalypb.DeleteRefsError_ReferencesLocked{ + ReferencesLocked: &gitalypb.ReferencesLockedError{ + Refs: [][]byte{[]byte("refs/heads/master")}, + }, + }, + }) + require.NoError(t, errGeneratingDetailedErr) + testhelper.RequireGrpcError(t, detailedErr, err) + } else { + require.NoError(t, err) + assert.Contains(t, response.GetGitError(), "reference is already locked") + } } func TestDeleteRefs_validation(t *testing.T) { diff --git a/internal/metadata/featureflag/ff_delete_refs_structured_errors.go b/internal/metadata/featureflag/ff_delete_refs_structured_errors.go new file mode 100644 index 000000000..eca4647c7 --- /dev/null +++ b/internal/metadata/featureflag/ff_delete_refs_structured_errors.go @@ -0,0 +1,9 @@ +package featureflag + +// DeleteRefsStructuredErrors turns on metrics for pack objects +var DeleteRefsStructuredErrors = NewFeatureFlag( + "delete_refs_structured_errors", + "v15.3.0", + "https://gitlab.com/gitlab-org/gitaly/-/issues/4348", + false, +) diff --git a/proto/errors.proto b/proto/errors.proto index 4a600adc5..dbead8f0e 100644 --- a/proto/errors.proto +++ b/proto/errors.proto @@ -56,6 +56,8 @@ message MergeConflictError { // ReferencesLockedError is an error returned when an ref update fails because // the references have already been locked by another process. message ReferencesLockedError { + // Refs are the references that could not be locked. + repeated bytes refs = 1; } // ReferenceExistsError is an error returned when a reference that ought not to exist does exist diff --git a/proto/go/gitalypb/errors.pb.go b/proto/go/gitalypb/errors.pb.go index 1b2c2d7f8..af8b3b04d 100644 --- a/proto/go/gitalypb/errors.pb.go +++ b/proto/go/gitalypb/errors.pb.go @@ -381,6 +381,9 @@ type ReferencesLockedError struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + // Refs are the references that could not be locked. + Refs [][]byte `protobuf:"bytes,1,rep,name=refs,proto3" json:"refs,omitempty"` } func (x *ReferencesLockedError) Reset() { @@ -415,6 +418,13 @@ func (*ReferencesLockedError) Descriptor() ([]byte, []int) { return file_errors_proto_rawDescGZIP(), []int{5} } +func (x *ReferencesLockedError) GetRefs() [][]byte { + if x != nil { + return x.Refs + } + return nil +} + // ReferenceExistsError is an error returned when a reference that ought not to exist does exist // already. type ReferenceExistsError struct { @@ -801,54 +811,55 @@ var file_errors_proto_rawDesc = []byte{ 0x73, 0x12, 0x34, 0x0a, 0x16, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x6f, 0x6e, 0x66, 0x6c, 0x69, 0x63, 0x74, 0x69, 0x6e, 0x67, 0x43, 0x6f, - 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x64, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x52, 0x65, 0x66, 0x65, 0x72, + 0x6d, 0x6d, 0x69, 0x74, 0x49, 0x64, 0x73, 0x22, 0x2b, 0x0a, 0x15, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x64, 0x45, 0x72, 0x72, 0x6f, 0x72, - 0x22, 0x4f, 0x0a, 0x14, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x45, 0x78, 0x69, - 0x73, 0x74, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x0d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x10, 0x0a, 0x03, 0x6f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6f, 0x69, - 0x64, 0x22, 0x3f, 0x0a, 0x16, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x6f, - 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x72, - 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x61, - 0x6d, 0x65, 0x22, 0x6f, 0x0a, 0x14, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, - 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x0d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, - 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x6c, 0x64, 0x5f, 0x6f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x6f, 0x6c, 0x64, 0x4f, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x65, - 0x77, 0x5f, 0x6f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x65, 0x77, - 0x4f, 0x69, 0x64, 0x22, 0x32, 0x0a, 0x14, 0x52, 0x65, 0x73, 0x6f, 0x6c, 0x76, 0x65, 0x52, 0x65, - 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, - 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x72, - 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x6d, 0x0a, 0x0a, 0x4c, 0x69, 0x6d, 0x69, 0x74, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, 0x0a, 0x0b, 0x72, 0x65, - 0x74, 0x72, 0x79, 0x5f, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, 0x72, 0x65, 0x74, 0x72, - 0x79, 0x41, 0x66, 0x74, 0x65, 0x72, 0x22, 0xf2, 0x01, 0x0a, 0x0f, 0x43, 0x75, 0x73, 0x74, 0x6f, - 0x6d, 0x48, 0x6f, 0x6f, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, - 0x64, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x74, 0x64, 0x6f, - 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x12, 0x3d, 0x0a, 0x09, 0x68, 0x6f, - 0x6f, 0x6b, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, - 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x48, 0x6f, 0x6f, - 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x08, 0x68, 0x6f, 0x6f, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0x70, 0x0a, 0x08, 0x48, 0x6f, 0x6f, - 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x48, 0x4f, 0x4f, 0x4b, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x18, 0x0a, 0x14, 0x48, 0x4f, 0x4f, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x52, - 0x45, 0x52, 0x45, 0x43, 0x45, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x48, 0x4f, - 0x4f, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x02, - 0x12, 0x19, 0x0a, 0x15, 0x48, 0x4f, 0x4f, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x4f, - 0x53, 0x54, 0x52, 0x45, 0x43, 0x45, 0x49, 0x56, 0x45, 0x10, 0x03, 0x42, 0x34, 0x5a, 0x32, 0x67, - 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, - 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x35, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x12, 0x0a, 0x04, 0x72, 0x65, 0x66, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x04, + 0x72, 0x65, 0x66, 0x73, 0x22, 0x4f, 0x0a, 0x14, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0e, + 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6f, 0x69, 0x64, 0x22, 0x3f, 0x0a, 0x16, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, + 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, + 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x6f, 0x0a, 0x14, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, + 0x6e, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x25, + 0x0a, 0x0e, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x6c, 0x64, 0x5f, 0x6f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x6c, 0x64, 0x4f, 0x69, 0x64, 0x12, 0x17, + 0x0a, 0x07, 0x6e, 0x65, 0x77, 0x5f, 0x6f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x6e, 0x65, 0x77, 0x4f, 0x69, 0x64, 0x22, 0x32, 0x0a, 0x14, 0x52, 0x65, 0x73, 0x6f, 0x6c, + 0x76, 0x65, 0x52, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, + 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x08, 0x72, 0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x6d, 0x0a, 0x0a, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, + 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x3a, + 0x0a, 0x0b, 0x72, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a, + 0x72, 0x65, 0x74, 0x72, 0x79, 0x41, 0x66, 0x74, 0x65, 0x72, 0x22, 0xf2, 0x01, 0x0a, 0x0f, 0x43, + 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x48, 0x6f, 0x6f, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x16, + 0x0a, 0x06, 0x73, 0x74, 0x64, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, + 0x73, 0x74, 0x64, 0x6f, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x12, 0x3d, + 0x0a, 0x09, 0x68, 0x6f, 0x6f, 0x6b, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x20, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x43, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x48, 0x6f, 0x6f, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x2e, 0x48, 0x6f, 0x6f, 0x6b, 0x54, + 0x79, 0x70, 0x65, 0x52, 0x08, 0x68, 0x6f, 0x6f, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x22, 0x70, 0x0a, + 0x08, 0x48, 0x6f, 0x6f, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x48, 0x4f, 0x4f, + 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x48, 0x4f, 0x4f, 0x4b, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x50, 0x52, 0x45, 0x52, 0x45, 0x43, 0x45, 0x49, 0x56, 0x45, 0x10, 0x01, 0x12, 0x14, + 0x0a, 0x10, 0x48, 0x4f, 0x4f, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x50, 0x44, 0x41, + 0x54, 0x45, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x48, 0x4f, 0x4f, 0x4b, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x50, 0x4f, 0x53, 0x54, 0x52, 0x45, 0x43, 0x45, 0x49, 0x56, 0x45, 0x10, 0x03, 0x42, + 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, + 0x74, 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2f, + 0x76, 0x31, 0x35, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x69, 0x74, + 0x61, 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/ruby/proto/gitaly/errors_pb.rb b/ruby/proto/gitaly/errors_pb.rb index f772b7291..1691cc760 100644 --- a/ruby/proto/gitaly/errors_pb.rb +++ b/ruby/proto/gitaly/errors_pb.rb @@ -26,6 +26,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do repeated :conflicting_commit_ids, :string, 2 end add_message "gitaly.ReferencesLockedError" do + repeated :refs, :bytes, 1 end add_message "gitaly.ReferenceExistsError" do optional :reference_name, :bytes, 1 |