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:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2021-08-04 09:46:36 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2021-08-06 16:24:56 +0300
commit054fa09e147949da0ae26065d798bc84141be6ae (patch)
treeae1e0e1a7571136a0beb1935ef8b7b66997d2be7 /internal/gitaly/service/operations/merge.go
parentedcd468fa1f7693b0cb0508f82953f75492b8db2 (diff)
operations: Validate early whether UserFFBranch got a repository
We're currently relying on the fact that any of the called functions in UserFFBranch will return an error if the request's repository is unset. This is quite fragile and is bound to break as soon as the logic of UserFFBranch changes. Fix this by validating early whether the request has a repository or not.
Diffstat (limited to 'internal/gitaly/service/operations/merge.go')
-rw-r--r--internal/gitaly/service/operations/merge.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/gitaly/service/operations/merge.go b/internal/gitaly/service/operations/merge.go
index 79e1598e7..7303c4f1b 100644
--- a/internal/gitaly/service/operations/merge.go
+++ b/internal/gitaly/service/operations/merge.go
@@ -137,6 +137,10 @@ func (s *Server) UserMergeBranch(stream gitalypb.OperationService_UserMergeBranc
}
func validateFFRequest(in *gitalypb.UserFFBranchRequest) error {
+ if in.Repository == nil {
+ return fmt.Errorf("empty repository")
+ }
+
if len(in.Branch) == 0 {
return fmt.Errorf("empty branch name")
}