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:
authorSami Hiltunen <shiltunen@gitlab.com>2021-07-21 13:37:40 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2021-07-23 11:57:42 +0300
commit55488e5c3ac398359edf64aec613b6a31ca623c8 (patch)
tree8f9ca305a738d816b9f5f667e378e1c7c234c157
parentbdb785c8d2d7361d31a3f3649ca25cfae56b153c (diff)
Fix mirroring empty repository in UpdateRemoteMirror
UpdateRemoteMirror's Ruby implementation did not handle the case when there were no branches in the repository that source repository when mirroring and failed when trying to access its default branch. The RPC then failed with a NoMethodError when trying to invoke a method on a Nil object. The Go implementation matched the behavior to pass the existing tests. Now that the Go implementation is enabled always, we can drop this behavior and allow the repository mirroring to work even if there are no branches in the source repository. Changelog: fixed
-rw-r--r--internal/gitaly/service/remote/update_remote_mirror.go5
-rw-r--r--internal/gitaly/service/remote/update_remote_mirror_test.go6
2 files changed, 3 insertions, 8 deletions
diff --git a/internal/gitaly/service/remote/update_remote_mirror.go b/internal/gitaly/service/remote/update_remote_mirror.go
index cc9211c26..ff884fce6 100644
--- a/internal/gitaly/service/remote/update_remote_mirror.go
+++ b/internal/gitaly/service/remote/update_remote_mirror.go
@@ -106,11 +106,6 @@ func (s *server) updateRemoteMirror(stream gitalypb.RemoteService_UpdateRemoteMi
return fmt.Errorf("get local references: %w", err)
}
- if len(localRefs) == 0 {
- // https://gitlab.com/gitlab-org/gitaly/-/issues/3503
- return errors.New("close stream to gitaly-ruby: rpc error: code = Unknown desc = NoMethodError: undefined method `id' for nil:NilClass")
- }
-
defaultBranch, err := ref.DefaultBranchName(ctx, repo)
if err != nil {
return fmt.Errorf("get default branch: %w", err)
diff --git a/internal/gitaly/service/remote/update_remote_mirror_test.go b/internal/gitaly/service/remote/update_remote_mirror_test.go
index 715486a07..6033c873e 100644
--- a/internal/gitaly/service/remote/update_remote_mirror_test.go
+++ b/internal/gitaly/service/remote/update_remote_mirror_test.go
@@ -59,12 +59,12 @@ func TestUpdateRemoteMirror(t *testing.T) {
expectedMirrorRefs map[string]string
}{
{
- // https://gitlab.com/gitlab-org/gitaly/-/issues/3503
- desc: "empty mirror source fails",
+ desc: "empty mirror source works",
mirrorRefs: refs{
"refs/heads/tags": {"commit 1"},
},
- errorContains: "rpc error: code = Internal desc = close stream to gitaly-ruby: rpc error: code = Unknown desc = NoMethodError: undefined method `id' for nil:NilClass",
+ response: &gitalypb.UpdateRemoteMirrorResponse{},
+ expectedMirrorRefs: map[string]string{},
},
{
desc: "mirror is up to date",