Validate branches Cannot Create - when creating second merge request with same source-target branches
### Summary
When creating a second merge request using the same source/target branch combination results in error
>The form contains the following error:
Validate branches Cannot Create: This merge request already exists:
### Steps to reproduce
* Create a branch - initial-branch
* Create a merge request using initial-branch to master
* Create a merge request using initial-branch to master
* On submit - error results
### What is the current *bug* behavior?
An error is displayed
>The form contains the following error:
Validate branches Cannot Create: This merge request already exists:
merge request is not created.
### What is the expected *correct* behavior?
Merge request to be created
### Relevant logs and/or screenshots
gdk errors out as 500 after making gitaly calls, no errors seen in other logs or developer web console.
### Output of checks
Also happens on GitLab.com and older versions.
#### Results of GitLab environment info
<details>
<summary>Expand for output related to GitLab environment info</summary>
<pre>
System information
System: Ubuntu 16.04
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.3.5p376
Gem Version: 2.6.13
Bundler Version:1.13.7
Rake Version: 12.1.0
Redis Version: 3.2.5
Git Version: 2.13.6
Sidekiq Version:5.0.4
Go Version: unknown
GitLab information
Version: 10.1.2-ee
Revision: 9937019
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
DB Version: 9.6.5
URL: http://astrachan-latest
HTTP Clone URL: http://astrachan-latest/some-group/some-project.git
SSH Clone URL: git@astrachan-latest:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 5.9.3
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks
Git: /opt/gitlab/embedded/bin/git
</pre>
</details>
#### Results of GitLab application Check
<details>
<summary>Expand for output related to the GitLab application check</summary>
<pre>
root@astrachan-latest:~# sudo gitlab-rake gitlab:check SANITIZE=true
Checking GitLab Shell ...
GitLab Shell version >= 5.9.3 ? ... OK (5.9.3)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
2/1 ... ok
3/2 ... ok
9/3 ... ok
6/4 ... ok
6/5 ... ok
3/6 ... ok
6/7 ... repository is empty
6/8 ... repository is empty
6/9 ... repository is empty
6/10 ... ok
6/11 ... repository is empty
6/12 ... repository is empty
1/13 ... ok
1/14 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
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: ...
2/1 ... yes
...
1/14 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.3 ? ... yes (2.3.5)
Git version >= 2.7.3 ? ... yes (2.13.6)
Git user has default SSH configuration? ... yes
Active users: ... 6
Elasticsearch version 5.1 - 5.5? ... skipped (elasticsearch is disabled)
Checking GitLab ... Finished
(we will only investigate if the tests are passing)
</pre>
</details>
### Possible fixes
Error happens after click 'Submit Merge Request'
issue