Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
39f77ad9
Commit
39f77ad9
authored
Feb 18, 2019
by
Balasankar "Balu" C
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let users set name/path on project fork using API
parent
ab9f8785
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
2 deletions
+19
-2
app/services/projects/fork_service.rb
app/services/projects/fork_service.rb
+10
-2
changelogs/unreleased/40795-set-project-name-on-fork-api.yml
changelogs/unreleased/40795-set-project-name-on-fork-api.yml
+5
-0
doc/api/projects.md
doc/api/projects.md
+2
-0
lib/api/projects.rb
lib/api/projects.rb
+2
-0
No files found.
app/services/projects/fork_service.rb
View file @
39f77ad9
...
...
@@ -38,8 +38,8 @@ module Projects
new_params
=
{
visibility_level:
allowed_visibility_level
,
description:
@project
.
description
,
name:
@project
.
name
,
path:
@project
.
path
,
name:
target_
name
,
path:
target_
path
,
shared_runners_enabled:
@project
.
shared_runners_enabled
,
namespace_id:
target_namespace
.
id
,
fork_network:
fork_network
,
...
...
@@ -94,6 +94,14 @@ module Projects
Projects
::
ForksCountService
.
new
(
@project
).
refresh_cache
end
def
target_path
@target_path
||=
@params
[
:path
]
||
@project
.
path
end
def
target_name
@target_name
||=
@params
[
:name
]
||
@project
.
name
end
def
target_namespace
@target_namespace
||=
@params
[
:namespace
]
||
current_user
.
namespace
end
...
...
changelogs/unreleased/40795-set-project-name-on-fork-api.yml
0 → 100644
View file @
39f77ad9
---
title
:
Add ability to set path and name for project on fork using API
merge_request
:
25363
author
:
type
:
added
doc/api/projects.md
View file @
39f77ad9
...
...
@@ -771,6 +771,8 @@ POST /projects/:id/fork
| --------- | ---- | -------- | ----------- |
|
`id`
| integer/string | yes | The ID or
[
URL-encoded path of the project
](
README.md#namespaced-path-encoding
)
|
|
`namespace`
| integer/string | yes | The ID or path of the namespace that the project will be forked to |
|
`path`
| string | no | The path that will be assigned to the resultant project after forking |
|
`name`
| string | no | The name that will be assigned to the resultant project after forking |
## List Forks of a project
...
...
lib/api/projects.rb
View file @
39f77ad9
...
...
@@ -258,6 +258,8 @@ module API
end
params
do
optional
:namespace
,
type:
String
,
desc:
'The ID or name of the namespace that the project will be forked into'
optional
:path
,
type:
String
,
desc:
'The path that will be assigned to the fork'
optional
:name
,
type:
String
,
desc:
'The name that will be assigned to the fork'
end
post
':id/fork'
do
Gitlab
::
QueryLimiting
.
whitelist
(
'https://gitlab.com/gitlab-org/gitlab-ce/issues/42284'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment