snitch
                                
                                 snitch copied to clipboard
                                
                                    snitch copied to clipboard
                            
                            
                            
                        Repo detection breaks on repositories on GitLab's subgroups
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:
[email protected]: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
- make sure you have credentials for gitlab.comin your.config/snitch/gitlab.ini
- run git clone https://gitlab.com/mikotests/tsoding/golang/snitch.git
- go inside the folder of the repository (cd snitch)
- run snitch reportin the folder of the cloned repository
Result: Detected project: https://gitlab.com/mikotests/tsoding
(for review and notice: @rexim)