// Fork creates a user fork of a GitLab project
Fork creates a user fork of a GitLab project
// Fork creates a user fork of a GitLab project
func Fork(project string) (string, error) {
	if !strings.Contains(project, "/") {
		return "", errors.New("remote must include namespace")
	}
	parts := strings.Split(project, "/")
	target, err := FindProject(parts[1])
	if err == nil {
		return target.SSHURLToRepo, nil
	} else if err != nil && err != ErrProjectNotFound {
		return "", err
	}
	target, err = FindProject(project)
	if err != nil {
		return "", err
	}
	var opts gitlab.ForkProjectOptions
	fork, _, err := lab.Projects.ForkProject(target.ID, &opts)
	if err != nil {
		return "", err
	}
	return fork.SSHURLToRepo, nil
}
func Fork ( project string ) ( string , error ) { if ! strings . Contains ( project , " " ) { return " " , errors . New ( " " ) } parts := strings . Split ( project , " " ) target , err := FindProject ( parts [ 1 ] ) if err == nil { return target . SSHURLToRepo , nil } else if err != nil && err != ErrProjectNotFound { return " " , err } target , err = FindProject ( project ) if err != nil { return " " , err } var opts gitlab . ForkProjectOptions fork , _ , err := lab . Projects . ForkProject ( target . ID , & opts ) if err != nil { return " " , err } return fork . SSHURLToRepo , nil }
Fork creates a user fork of a GitLab project
Fork creates a user fork of a GitLab project
// See if a fork already exists