API: path and name attribute are being ignored when forking a project
Summary
When forking a project over the API, the path and name attribute are being ignored.
Relevant documentation: https://docs.gitlab.com/ee/api/projects.html#fork-project
Steps to reproduce
POST request to <gitlab instance url>/projects/<project id>/fork
request params:
{
"private_token": "...",
"namespace": "<target namespace id>",
"name": "<fork project name>",
"path": "<fork path within namespace>"
}
Example Project
None
What is the current bug behavior?
The resulting fork has the same name and path within the namespace as the original project.
What is the expected correct behavior?
The forked project should have the name and path specified in the request.
Relevant logs and/or screenshots
POST request to <gitlab instance url>/projects/2/fork:
{
"private_token": "...",
"namespace": "5",
"name": "proj_config-gen_gitlab-test3",
"path": "proj_config-gen_gitlab-test3"
}
Result:
{
"id": 46,
"description": "",
"name": "ENoP Netauto Config Generator",
"name_with_namespace": "Config Gen Projects Test / ENoP Netauto Config Generator",
"path": "enop_netauto_configgenerator",
"path_with_namespace": "config-gen-projects-test/enop_netauto_configgenerator",
...
"forked_from_project": {
"id": 2,
"description": "",
"name": "ENoP Netauto Config Generator",
"name_with_namespace": "Netauto / ENoP Netauto Config Generator",
"path": "enop_netauto_configgenerator",
...
"import_status": "scheduled",
"import_error": null,
...
}
GET request to <gitlab instance url>/projects/46?private_token=... (to check import status):
Result:
{
"id": 46,
"description": "",
"name": "ENoP Netauto Config Generator",
"name_with_namespace": "Config Gen Projects Test / ENoP Netauto Config Generator",
"path": "enop_netauto_configgenerator",
"path_with_namespace": "config-gen-projects-test/enop_netauto_configgenerator",
"created_at": "2019-03-21T13:15:42.266Z",
...
"import_status": "finished",
"import_error": null,
...
}
Output of checks
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:env:info)
# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
# uname -a
Linux gitlab.<snip> 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
# gitlab-rake gitlab:env:info
System information
System:
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 2.5.3p105
Gem Version: 2.7.6
Bundler Version:1.16.6
Rake Version: 12.3.2
Redis Version: 3.2.12
Git Version: 2.18.1
Sidekiq Version:5.2.5
Go Version: unknown
GitLab information
Version: 11.8.1-ee
Revision: 39d0b2e
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
DB Version: 9.6.11
URL: https://gitlab.<snip>
HTTP Clone URL: https://gitlab.<snip>/some-group/some-project.git
SSH Clone URL: git@gitlab.<snip>:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: yes
Using Omniauth: yes
Omniauth Providers:
GitLab Shell
Version: 8.4.4
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
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(we will only investigate if the tests are passing)
# gitlab-rake gitlab:check SANITIZE=true
Checking GitLab subtasks ...
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 8.4.4 ? ... OK (8.4.4)
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 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: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... Server: ldapmain
not verifying SSL hostname of LDAPS server '<snip>:636'
LDAP authentication... Success
LDAP users with access to your GitLab server (only showing the first 100 results)
DN: cn=<snip>,ou=users,ou=<snip>,dc=<snip>,dc=<snip> sAMAccountName: <snip>
DN: cn=gitlab api,ou=users,ou=<snip>,dc=<snip>,dc=<snip> sAMAccountName: gitlab-api
DN: cn=<snip>,ou=users,ou=<snip>,dc=<snip>,dc=<snip> sAMAccountName: <snip>
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? ... skipped (no tmp uploads folder yet)
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: ...
3/1 ... yes
3/2 ... yes
5/34 ... yes
5/35 ... yes
5/36 ... yes
5/37 ... yes
5/38 ... yes
5/39 ... yes
5/40 ... yes
5/41 ... yes
5/42 ... yes
3/43 ... yes
5/46 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.5 ? ... yes (2.5.3)
Git version >= 2.18.0 ? ... yes (2.18.1)
Git user has default SSH configuration? ... yes
Active users: ... 4
Elasticsearch version 5.6 - 6.x? ... skipped (elasticsearch is disabled)
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished