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

GitLab GetCloneURL returns the wrong clone url in certain conditions #267

Open
janderssonse opened this issue Mar 24, 2024 · 1 comment
Open

Comments

@janderssonse
Copy link

janderssonse commented Mar 24, 2024

Describe the bug

GitLab GetCloneUrl returns the wrong clone url in certain conditions.

To Reproduce

Here is a public project where you can reproduce it: https://gitlab.com/hanklank/anki-lpic

  • With the library - list public repositories for this user: https://gitlab.com/hanklank
  • Print out the clone urls for the project anki-lpic.
    *Notice that the clone URL should end with: anki-lpic - but ends with lpic. This means the one gets the wrong clone url, and cant clone it.

Had quick look in the code, The error is likely due to that go-git-providers only use the project name when creating the repository struct, and does not care about the real clone url - these will differ at times, like in the case given-> project NAME is lpic, but CLONE URL (and project path) is anki-lpic. I think if go-gitprovider would replace using Name with Path from the gitlab api it would fix it for all cases.
Example: https://gitlab.com/api/v4/projects/hanklank%2Fanki-lpic name differs from clone url.

Currently this leads to GetCloneURL always giving the wrong clone url in these cases.

repos = append(repos, newUserProject(c.clientContext, apiObj, gitprovider.UserRepositoryRef{

(same with org-repos so it would need to be fixed there too)

Expected behavior

GitLab's GetCloneUrl should end in the real clone url, ie anki-lpic not in project name lpic.

Additional context

  • Go version: 1.22
  • Git provider: GitLab
@janderssonse
Copy link
Author

janderssonse commented Sep 1, 2024

Bump, (as no-one responded since March, and it is kind of a blocker for getting correct urls - which at least I think it quite a major bug ) - is anyone maintaining the GitLab parts of the library? Currently it means the library is unusable for GitLab repos where the clone URL and project name differs. It would be great to know if this is an bug that likely will be fixed by the project or not, as then one can ponder either attempting a fix by a PR or just skip using the provider library and use the go-gitlab library directly. Thanks.

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

1 participant