diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-27 08:52:37 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-29 09:33:48 +0300 |
commit | 87af403602415fe53fb72fe33b5896116a412d92 (patch) | |
tree | 692f8512e14335f20faedaa897c9ad878a257f32 | |
parent | a1feaf59920d9263480618bb359a6f6e9bd0f2fc (diff) |
ssh: Simplify handling of `GlRepository()` for logging purposes
When receiving an SSHUploadPack request we log some information included
in the request. Part of that information is the information about the
GitLab repository the request has been created for, which we laboriously
extract from the request while paying attention to not dereference any
`nil` pointers.
Simplify the code to insetad use the Protobuf's getter functions, which
already know to handle `nil` pointers for us.
-rw-r--r-- | internal/gitaly/service/ssh/upload_pack.go | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/internal/gitaly/service/ssh/upload_pack.go b/internal/gitaly/service/ssh/upload_pack.go index 807735bbc..d17fafcf5 100644 --- a/internal/gitaly/service/ssh/upload_pack.go +++ b/internal/gitaly/service/ssh/upload_pack.go @@ -28,13 +28,8 @@ func (s *server) SSHUploadPack(stream gitalypb.SSHService_SSHUploadPackServer) e return helper.ErrInternal(err) } - repository := "" - if req.Repository != nil { - repository = req.Repository.GlRepository - } - ctxlogrus.Extract(ctx).WithFields(log.Fields{ - "GlRepository": repository, + "GlRepository": req.GetRepository().GetGlRepository(), "GitConfigOptions": req.GitConfigOptions, "GitProtocol": req.GitProtocol, }).Debug("SSHUploadPack") |