Skip to content

Support expected_old_oid in user_commit_files

What does this MR do and why?

Resolves #384017 (closed)

Feature flag rollout issue: #479424 (closed)

This MR passes a target_sha to gitaly as expected_old_id to handle race conditions between different clients. The expected_old_oid verifies that the latest sha of the target branch has not changed since beginning the request to commit files.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Smoke tests

  1. Successfully create a snippet
  2. Successfully create a wiki
  3. Successfully update the previous wiki
  4. Using the web IDE, edit a file and commit the changes to a new branch
  5. Using the web IDE, edit a file and commit the changes to an existing branch

Functional tests

With the feature flag ON:

  1. Hardcode an invalid sha (8749d49930866a4871fa086adbd7d2057fcc3ebb) here and try to commit a change from the web IDE. The commit should not succeed, and you should not receive a 500.
  2. Hardcode a sha that is a valid sha in the repository, but is not the latest sha of the branch. Try to commit a change from the web IDE. The commit should not succeed, and you should not receive a 500.

With the feature flag OFF:

  1. Hardcode an invalid sha (8749d49930866a4871fa086adbd7d2057fcc3ebb) here and try to commit a change from the web IDE. Your commit should succeed.

Numbered steps to set up and validate the change are strongly suggested.

Edited by Fred Reinink

Merge request reports

Loading