Skip to content

Repo detection breaks on repositories on GitLab's subgroups #229

@miko007

Description

@miko007

Tasks

  • update regex, so it covers nested namespaces
  • update following code to assemble the reported repo URL correctly

Description

On an GitLab instance, it is possible to have nested groups of arbitrary depth. The regex on line 269 in main.go does not cover this case:

s := creds.getHost() + "[:/]([-\\.\\w]+)\\/([-\\.\\w]+)"

This regex does not match on an repository URL in the format of:
git@gitlab.com:organisation/subgroup/subsubgroup/repository.git.

snitch will discover the repository at organisation/subgroup.

This is addressed by #176, but the human that proposed that pull request seems not to be further interested in getting it merged, as @rexim's request for change in form of unit tests has been ignored for almost three years now.

Steps to reproduce

  1. make sure you have credentials for gitlab.com in your .config/snitch/gitlab.ini
  2. run git clone https://gitlab.com/mikotests/tsoding/golang/snitch.git
  3. go inside the folder of the repository (cd snitch)
  4. run snitch report in the folder of the cloned repository

Result: Detected project: https://gitlab.com/mikotests/tsoding

(for review and notice: @rexim)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions