Github importer does not create branch "pull/{number}/{branch-ref}" if the Github PR merging from someone:branchA to our-repo:branchB
Summary
Github importer does not create branch "pull/{number}/{branch-ref}" if the Github PR merging from someone:branchA to our-repo:branchB. But if the source branch in the forked repo and target branch in the main repo has the same name, such "pull/{number}/{branch-ref}" branch could be created.
Steps to reproduce
- Create a project at Github and fork it as a forked project.
- In the forked Github project create a new branch with a name of patch-1 and commit a change.
- Create a pull request to merge forked-repo:patch-1 to main-repo:master.
- Setup OAuth using Github authentication on Gitlab
- Import the Github main project to Gitlab
What is the current bug behavior?
In migrated merge request from such pull request you can see the branch name of "pull/{number}/{branch-ref}" but such branch is not created. But if the source branch and target branch have the same name in the main repo and forked repo, the "pull/{number}/{branch-ref}" branch is created.
What is the expected correct behavior?
The "pull/{number}/{branch-ref}" branch is created no matter the source and target have the same name or not. Or better way to handle the pull request migration for merge across master and forked project.
Relevant logs and/or screenshots
The issue with branches with different name in the migrated merge request:
And the corresponding pull request in Github as below:
Branch created if ref names are the same across the master and forked repo:
And corresponding pull request from Github as below:
Output of checks
N/A
Results of GitLab environment info
System information
System: Ubuntu 14.04
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.3.3p222
Gem Version: 2.6.6
Bundler Version:1.13.7
Rake Version: 10.5.0
Redis Version: 3.2.5
Sidekiq Version:4.2.7
GitLab information
Version: 8.17.2-ee
Revision: 474978d
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
DB Version: 9.2.18
URL: http://172.16.81.151
HTTP Clone URL: http://172.16.81.151/some-group/some-project.git
SSH Clone URL: git@172.16.81.151:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: github
GitLab Shell
Version: 4.1.1
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Checking GitLab Shell ...
GitLab Shell version >= 4.1.1 ? ... OK (4.1.1)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
1/14 ... ok
29/15 ... ok
32/16 ... ok
1/17 ... ok
1/18 ... ok
33/20 ... ok
29/21 ... repository is empty
25/34 ... ok
1/46 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Check GitLab API access: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: OK
Send ping to redis server: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory setup correctly? ... 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: ...
1/14 ... yes
29/15 ... yes
32/16 ... yes
1/17 ... yes
1/18 ... yes
33/20 ... yes
29/21 ... yes
25/34 ... yes
1/46 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.1.0 ? ... yes (2.3.3)
Your git bin path is "/opt/gitlab/embedded/bin/git"
Git version >= 2.7.3 ? ... yes (2.10.2)
Active users: 5
Checking GitLab ... Finished
Possible fixes
N/A