diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-02-24 12:43:37 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-03-01 17:09:30 +0300 |
commit | ea0ac3215cedd17cf113b30ce33a95c0d38673d7 (patch) | |
tree | a73a3d923fd5102dcfbe782e37dad8b0a016c020 | |
parent | 715f4da107598da0fca68d446ca9c8990e93518f (diff) |
operations: Return error from UserSquash when merging failspks-user-squash-structured-errors
We do not return an error in case creating the squashed merge commit in
UserSquash call fails. This makes us blind for the error conditions in
this RPC, which is in turn creating problems in Praefect setups where we
have to rely on errors in order to decide whether we have to create
replication jobs or not.
Return an error in case the merge fails. Note that we don't return a
structured error in this case: the range of commits we're about to
squash-merge has already been rebased, so we do not expect to ever see a
merge conflict here. As a consequence, a failure to create the merge
commit is unexpected and thus doesn't warrant its own error type.
Changelog: changed
-rw-r--r-- | internal/gitaly/service/operations/squash.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/gitaly/service/operations/squash.go b/internal/gitaly/service/operations/squash.go index b4bc3f644..4a942a15e 100644 --- a/internal/gitaly/service/operations/squash.go +++ b/internal/gitaly/service/operations/squash.go @@ -251,6 +251,10 @@ func (s *Server) userSquash(ctx context.Context, req *gitalypb.UserSquashRequest treeID.String(), }, }, git.WithStdout(&stdout), git.WithStderr(&stderr), git.WithEnv(commitEnv...)); err != nil { + if featureflag.UserSquashImprovedErrorHandling.IsEnabled(ctx) { + return "", helper.ErrInternalf("creating squashed commit: %w", err) + } + return "", fmt.Errorf("creating commit: %w", gitError{ Err: err, ErrMsg: stderr.String(), |