Gitlab viewer showing incorrect code changes
Summary
We have encountered a reproduceable BUG whereby the Gitlab viewer showing incorrect code changes for a code merge. I will provide a sample file, and reproduction steps.
We are using on-prem v17.6.1-ee
The file looks like
If Line 58 is updated e.g., addition of text "odl-text-field" and a merge request submitted, then the viewer indicates that Line 60 (of the original code) has been deleted but appears as Line 58, and replaced with what the new value of Line 58 has become. Rather than just showing the modification to Line 58 that occurred.
If the code is merged, it is as expected i.e. only Line 58 is modified.
However, with such issues, code reviews are unreliable.
Steps to reproduce
- With the code provided, modify Line 58, add text to the end of the line e.g. class="w-full text-sm bg-transparent outline-none odl-text-field"
- Create merge request for this change
- Go to the merge request, look at the changes Tab
- See that the viewer infers that the actual Line 60 code "
bind:value={url}" is being deleted, which is not the case. - If the code is merged, it is as expected i.e. only Line 58 is modified.
Example Project
Either use the attached dummy.svelte file and reproduction steps; or
See this public project merge request public-gitlab-bugs/gitlab-viewer-bug!1 (diffs)
What is the current bug behavior?
See description.
What is the expected correct behavior?
The viewer should display the merge request changes correctly. i.e. modifications to Line 58 only in this case.
Relevant logs and/or screenshots
~/Development/temp/gitlab-viewer-bug on test ❯ git diff main
diff --git a/dummy.svelte b/dummy.svelte
index 2d7f50d..a23f169 100644
--- a/dummy.svelte
+++ b/dummy.svelte
@@ -55,7 +55,7 @@
{/if}
<input
- class="w-full text-sm bg-transparent outline-none"
+ class="w-full text-sm bg-transparent outline-none odl-text-test"
placeholder={$i18n.t('Enter URL (e.g. http://localhost:11434)')}
bind:value={url}
/>

