Add Git implementation of UserCommitFiles (revert of a revert and a fix)
!5565 (merged) added a Git implementation of UserCommitFiles. Unfortunately, this broke the Rails tests because there was a missed error message. Namely, Git2Go returned a specific error when the name or email was invalid, whereas Git returns a different error.
This MR reverts the revert and restores most of !5565 (merged), but adds a piece of error parsing that will allow Gitaly to return the error message that Rails expects.
The only difference is here
diff --git a/internal/gitaly/service/operations/commit_files.go b/internal/gitaly/service/operations/commit_files.go
index 2f69130c4..3af29ba6e 100644
--- a/internal/gitaly/service/operations/commit_files.go
+++ b/internal/gitaly/service/operations/commit_files.go
@@ -630,6 +630,10 @@ func (s *Server) userCommitFiles(ctx context.Context, header *gitalypb.UserCommi
}
if err != nil {
+ if strings.Contains(err.Error(), "name consists only of disallowed characters") {
+ return structerr.NewInvalidArgument("%w", ErrSignatureMissingNameOrEmail)
+ }
+
return err
}
gitlab!123427 (closed) has the commit id of this merge request and runs the full Rails pipeline to make sure tests pass.
Edited by John Cai