Skip to content

Fix file_has_changed? check to support later commits

Paul Slaughter requested to merge ps-fix-file-has-changed-check into master

What does this MR do and why?

This MR fixes a file_has_changed? method used when committing form the Web IDE, to support adding unrelated commits that are technically later than the latest commits for the specific file.

See this comment for context.

Screenshots or screen recordings

No user facing change in this MR, but this will fix an issue in an upcoming Web IDE MR.

Before After
Screenshot_2023-03-04_at_6.23.37_PM Screenshot_2023-03-04_at_6.24.23_PM

How to set up and validate locally

  1. Update the @gitlab/web-ide version to https://gitlab.com/gitlab-org/gitlab-web-ide/-/jobs/3873894772/artifacts/raw/tmp/packages/gitlab-web-ide-0.0.1-dev-20230304220143.tgz which comes from this MR (see patch below).
  2. Run yarn install and start the gdk.
  3. Enable the new Web IDE by running Feature.enable(:vscode_web_ide) in a rails console rails c.
  4. Visit the IDE for any project (for example, /-/ide/project/gitlab-org/gitlab-test/edit/master/)
  5. Edit a file that was not touched by the latest commit on the current branch (for example, files/js/application.js)
  6. Go to the "Source Control" tab and click "Commit & Push".
  7. Select "No Use the current branch".
  8. Commit should be successful 👍

Patch to update @gitlab/web-ide version

diff --git a/package.json b/package.json
index 2f6732ccc0b8..255bff95c21f 100644
--- a/package.json
+++ b/package.json
@@ -58,7 +58,7 @@
     "@gitlab/svgs": "3.22.0",
     "@gitlab/ui": "56.2.0",
     "@gitlab/visual-review-tools": "1.7.3",
-    "@gitlab/web-ide": "0.0.1-dev-20230223005157",
+    "@gitlab/web-ide": "https://gitlab.com/gitlab-org/gitlab-web-ide/-/jobs/3873894772/artifacts/raw/tmp/packages/gitlab-web-ide-0.0.1-dev-20230304220143.tgz",
     "@rails/actioncable": "6.1.4-7",
     "@rails/ujs": "6.1.4-7",
     "@sourcegraph/code-host-integration": "0.0.84",

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Paul Slaughter

Merge request reports