Skip to content

Commit

Permalink
gitlab: target fork name and path must not be empty
Browse files Browse the repository at this point in the history
It doesn't seems to be documented anywhere, but if namespace is set to a
custom place, name and path can't be empty. With that, this patch sets the
name of the target project fork to the original project name.

Signed-off-by: Bruno Meneguele <[email protected]>
  • Loading branch information
bmeneg committed Dec 17, 2020
1 parent 308d63a commit 8660629
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ func Fork(data ForkStruct, useHTTP bool, wait bool) (string, error) {

var forkOpts *gitlab.ForkProjectOptions = nil
if data.isCustomTargetSet() {
// Name and/or path must be set
if data.TargetName == "" && data.TargetPath == "" {
data.TargetName = target.Name
}
forkOpts = &gitlab.ForkProjectOptions{
Name: gitlab.String(data.TargetName),
Namespace: gitlab.String(data.TargetNamespace),
Expand Down

0 comments on commit 8660629

Please sign in to comment.