Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote repository URL is null #52

Open
cjsaohan opened this issue Dec 24, 2019 · 2 comments
Open

Remote repository URL is null #52

cjsaohan opened this issue Dec 24, 2019 · 2 comments

Comments

@cjsaohan
Copy link

TypeError (Remote repository URL is null):

plugins/redmine_gitlab_hook/app/controllers/gitlab_hook_controller.rb:157:in create_repository' plugins/redmine_gitlab_hook/app/controllers/gitlab_hook_controller.rb:135:in find_repository'
plugins/redmine_gitlab_hook/app/controllers/gitlab_hook_controller.rb:10:in `index'

what can id do ?

@kodiary
Copy link

kodiary commented Feb 4, 2020

For now, make sure that your project identifier and repo identifier name are same.

@byronwu1987
Copy link

  def create_repository(project)
    logger.debug('Trying to create repository...')
    raise TypeError, 'Local repository path is not set' unless Setting.plugin_redmine_gitlab_hook['local_repositories_path'].to_s.present?

    identifier = get_repository_identifier
    remote_url = params[:project][:ssh_url]
    prefix = Setting.plugin_redmine_gitlab_hook['git_command_prefix'].to_s

    raise TypeError, 'Remote repository URL is null' unless remote_url.present?

    local_root_path = Setting.plugin_redmine_gitlab_hook['local_repositories_path']
    repo_namespace = get_repository_namespace
    repo_name = get_repository_name
    if repo_namespace.nil?
      local_url = File.join(local_root_path, repo_name)
    else
      local_url = File.join(local_root_path, repo_namespace, repo_name)
    end
    git_file = File.join(local_url, 'HEAD')

    unless File.exists?(git_file)
      FileUtils.mkdir_p(local_url)
      command = clone_repository(prefix, remote_url, local_url)
      unless exec(command)
        raise RuntimeError, "Can't clone URL #{remote_url}"
      end
    end
    repository = Repository::Git.new
    repository.identifier = identifier
    repository.url = local_url
    repository.is_default = true
    repository.project = project
    repository.save
    return repository
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants