diff options
Diffstat (limited to 'internal/gitaly/service/ref/refexists.go')
-rw-r--r-- | internal/gitaly/service/ref/refexists.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/gitaly/service/ref/refexists.go b/internal/gitaly/service/ref/refexists.go index b081fbee2..aab56ca0e 100644 --- a/internal/gitaly/service/ref/refexists.go +++ b/internal/gitaly/service/ref/refexists.go @@ -6,6 +6,7 @@ import ( "strings" "gitlab.com/gitlab-org/gitaly/v15/internal/command" + gitalyerrors "gitlab.com/gitlab-org/gitaly/v15/internal/errors" "gitlab.com/gitlab-org/gitaly/v15/internal/git" "gitlab.com/gitlab-org/gitaly/v15/internal/helper" "gitlab.com/gitlab-org/gitaly/v15/proto/go/gitalypb" @@ -13,6 +14,10 @@ import ( // RefExists returns true if the given reference exists. The ref must start with the string `ref/` func (s *server) RefExists(ctx context.Context, in *gitalypb.RefExistsRequest) (*gitalypb.RefExistsResponse, error) { + if in.GetRepository() == nil { + return nil, helper.ErrInvalidArgument(gitalyerrors.ErrEmptyRepository) + } + ref := string(in.Ref) if !isValidRefName(ref) { |