gitaly_client: Fix error handling for structured AlreadyApplied error
What does this MR do and why?
With 21d14354 (Add structured error parsing for user_cherry_pick, 2022-05-04) we have introduced error handling for structuder errors returned by UserCherryPick. This new mode of error handling is slated to replace the old error reporting in Gitaly, which used to embed errors in a successful UserCherryPikc response.
This new error handling is missing the case where the commits we're about to cherry-pick have already been applied to the target branch and are thus empty, which is breaking some of our tests when upgrading to a Gitaly version that already has the structured error reporting.
Fix this by handling ChangesAlreadyApplied
errors equivalently to the
previous CreateTreeError
with its error code set to EMPTY
.
How to set up and validate locally
You can test this change by updating the GITALY_SERVER_VERSION to 93896418ff172cb6dd6022af855753e468116906 or later. https://gitlab.com/gitlab-org/gitlab/-/jobs/2648693824 shows the failing tests, where ./spec/requests/api/commits_spec.rb:1602
is the important one.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.