Merge in v12.3.0 corrupts source branch

Summary

When resolving conflicts in a merge request using the Gitlab web UI, all of the files and changes from the destination (target) branch are merged into the source prior to merging the source branch into the destination branch. There are cases where we do not want the source branch altered but only want the changes merged into the destination branch. This has caused major problems for us as we had to back out of the corruption of our source branches. Doing a merge with the git command line works fine. Gitlab v12.3.0 running on Red Hat EL 7.7, Omnibus installation

Steps to reproduce

  1. Create two branches within a project and make unique changes in each branch.
  2. Create a merge request for two non-master branches, each with changes.
  3. Navigate to "Merge Requests" and click on the "Resolve conflicts" button.
  4. The Merge Conflicts page presents the options to "use ours" or "use theirs" for one or more file conflicts. The commit message text says "Merge branch 'dest' into 'src'" regardless of which option is selected. The destination branch should not be merged into the source branch but there does not appear to be any way to resolve the conflict in the UI without this happening.
  5. Now that the merge conflicts are resolved, the source branch is updated with any files or changes found in the destination branch.
  6. Navigating back to the merge request page and hitting the "Merge" button updates the destination branch with the results of the merge. Now both branches are identical.

Example Project

https://gitlab.com/MarkTuck/test_proj

What is the current bug behavior?

The source branch is updated with changes and additions from the destination branch.

What is the expected correct behavior?

The source branch should be unaltered. Changes should only be occurring in the merge target branch.

Relevant logs and/or screenshots

N/A

Output of checks

This bug happens on GitLab.com as well as on our local installation of gitlab-ce

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Current User: git Using RVM: no Ruby Version: 2.6.3p62 Gem Version: 2.7.9 Bundler Version:1.17.3 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.22.0 Sidekiq Version:5.2.7 Go Version: go1.11.5 linux/amd64

GitLab information Version: 12.3.0 Revision: 7099ecf77cb Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 10.9 URL: https://gitlab.library.dartmouth.edu HTTP Clone URL: https://gitlab.library.dartmouth.edu/some-group/some-project.git SSH Clone URL: git@gitlab.library.dartmouth.edu:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers: cas3

GitLab Shell Version: 10.0.0 Repository storage paths:

  • default: /data/gitlab-data/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 10.0.0 ? ... OK (10.0.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK

gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Checking Reply by email ...

IMAP server credentials are correct? ... yes Init.d configured correctly? ... skipped MailRoom running? ... skipped

Checking Reply by email ... Finished

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 40/2 ... yes 40/3 ... yes 12/5 ... yes 3/7 ... yes 40/8 ... yes 40/9 ... yes 40/10 ... yes 3/11 ... yes 3/12 ... yes 3/13 ... yes 2/15 ... yes 3/18 ... yes 23/19 ... yes 38/20 ... yes 22/21 ... yes 3/22 ... yes 3/23 ... yes 22/24 ... yes 3/46 ... yes 3/47 ... yes 22/49 ... yes 22/50 ... yes 3/51 ... yes 22/52 ... yes 39/73 ... yes 39/74 ... yes 39/75 ... yes 39/76 ... yes 38/77 ... yes 39/78 ... yes 39/79 ... yes 39/80 ... yes 39/81 ... yes 39/82 ... yes 39/83 ... yes 39/84 ... yes 38/85 ... yes 3/86 ... yes 39/87 ... yes 38/88 ... yes 3/89 ... yes 39/90 ... yes 38/91 ... yes 38/92 ... yes 22/93 ... yes 3/94 ... yes 40/95 ... yes 3/96 ... yes 32/105 ... yes 32/106 ... yes 32/107 ... yes 32/108 ... yes 38/110 ... yes 38/111 ... yes 38/114 ... yes 3/115 ... yes 3/116 ... yes 12/117 ... yes 23/118 ... yes 23/119 ... yes 23/120 ... yes 23/121 ... yes 23/122 ... yes 23/123 ... yes 23/124 ... yes 23/125 ... yes 23/126 ... yes 23/127 ... yes 23/128 ... yes 23/129 ... yes 23/130 ... yes 23/131 ... yes 23/132 ... yes 23/133 ... yes 23/134 ... yes 23/135 ... yes 23/136 ... yes 23/137 ... yes 23/138 ... yes 23/139 ... yes 3/140 ... yes 23/141 ... yes 34/142 ... yes 35/145 ... yes 35/146 ... yes 35/147 ... yes 35/148 ... yes 35/149 ... yes 35/150 ... yes 35/151 ... yes 35/152 ... yes 23/153 ... yes 39/154 ... yes 39/155 ... yes 38/156 ... yes 3/157 ... yes 37/158 ... yes 38/159 ... yes 38/160 ... yes 38/161 ... yes 38/162 ... yes 3/167 ... yes 38/168 ... yes 39/169 ... yes 37/170 ... yes 37/171 ... yes 37/172 ... yes 38/173 ... yes 37/174 ... yes 3/175 ... yes 37/176 ... yes 37/177 ... yes 3/178 ... yes 37/179 ... yes 14/181 ... yes 3/182 ... yes 3/183 ... yes 3/184 ... yes 37/185 ... yes 38/186 ... yes 38/187 ... yes 3/188 ... yes 3/189 ... yes 43/225 ... yes 43/226 ... yes 37/334 ... yes 40/335 ... yes 42/336 ... yes 41/337 ... yes 41/338 ... yes 42/339 ... yes 42/340 ... yes 42/341 ... yes 42/342 ... yes 42/343 ... yes 42/344 ... yes 42/345 ... yes 42/346 ... yes 42/347 ... yes 42/348 ... yes 42/349 ... yes 42/350 ... yes 42/352 ... yes 42/353 ... yes 42/354 ... yes 42/355 ... yes 42/356 ... yes 42/357 ... yes 42/358 ... yes 42/359 ... yes 42/360 ... yes 41/361 ... yes 14/362 ... yes 37/372 ... yes 37/374 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.3) Git version >= 2.22.0 ? ... yes (2.22.0) Git user has default SSH configuration? ... yes Active users: ... 22 Is authorized keys file accessible? ... yes

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

The only workaround is to use git merge on the command line.