git-bug icon indicating copy to clipboard operation
git-bug copied to clipboard

GitLab bridge: URL param unclear and runtime error

Open pawamoy opened this issue 2 years ago • 4 comments

git-bug v0.7.2 linux adm64

Is it the server URL or a project URL?

When I run the command shown in the example of the help message, providing the server URL, git-bug asks me again the server URL, and then crashes:

$ git bug bridge configure --name=default --target=gitlab --url=https://my-private-gitlab.fr --login=mylogin --token=mytoken
Gitlab server URL [https://gitlab.com/]: https://my-private-gitlab.fr
panic: runtime error: slice bounds out of range [1:0]

goroutine 1 [running]:
github.com/MichaelMure/git-bug/bridge/gitlab.getProjectPath(0xc0000a0000, 0x18, 0x7ffd555304cb, 0x18, 0xc00019f9f8, 0x8d8c215f, 0x59256ae20b047479, 0xc0000b2480)
        /home/michael/dev/git-bug/bridge/gitlab/config.go:244 +0x315
github.com/MichaelMure/git-bug/bridge/gitlab.validateProjectURL(0xc0000a0000, 0x18, 0x7ffd555304cb, 0x18, 0xc0000aa000, 0x0, 0x0, 0x2)
        /home/michael/dev/git-bug/bridge/gitlab/config.go:267 +0x59
github.com/MichaelMure/git-bug/bridge/gitlab.(*Gitlab).Configure(0x113e120, 0xc000020100, 0x7ffd555304cb, 0x18, 0x0, 0x0, 0x7ffd555304ec, 0x8, 0x0, 0x0, ...)
        /home/michael/dev/git-bug/bridge/gitlab/config.go:113 +0x1cc
github.com/MichaelMure/git-bug/bridge/core.(*Bridge).Configure(0xc00007e900, 0x7ffd555304cb, 0x18, 0x0, 0x0, 0x7ffd555304ec, 0x8, 0x0, 0x0, 0x7ffd555304fd, ...)
        /home/michael/dev/git-bug/bridge/core/bridge.go:208 +0xb5
github.com/MichaelMure/git-bug/commands.runBridgeConfigure(0x10fe720, 0xc00022b400, 0x0, 0x5, 0x0, 0x0)
        /home/michael/dev/git-bug/commands/bridge_configure.go:83 +0x278
github.com/spf13/cobra.(*Command).execute(0x10fe720, 0xc00022b3b0, 0x5, 0x5, 0x10fe720, 0xc00022b3b0)
        /home/michael/go/pkg/mod/github.com/spf13/[email protected]/command.go:840 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0x1100e80, 0x0, 0x0, 0x0)
        /home/michael/go/pkg/mod/github.com/spf13/[email protected]/command.go:945 +0x336
github.com/spf13/cobra.(*Command).Execute(...)
        /home/michael/go/pkg/mod/github.com/spf13/[email protected]/command.go:885
github.com/MichaelMure/git-bug/commands.Execute()
        /home/michael/dev/git-bug/commands/root.go:54 +0x2d
main.main()
        /home/michael/dev/git-bug/git-bug.go:14 +0x25

pawamoy avatar Oct 20 '22 11:10 pawamoy

Would you mind checking if that bug still exist in master? v0.7.2 is very old. I need to make a new release, working my way there.

MichaelMure avatar Oct 22 '22 13:10 MichaelMure

Latest says "Error: bad project url" for the GitHub bridge, nothing for the GitLab one, so I guess --url should be given the project URL and not the server URL. Using the GitLab bridge, I'm prompted again to enter the server URL, and it doesn't crash once I've entered it :+1:

pawamoy avatar Oct 26 '22 19:10 pawamoy

This is what the doc says: -u, --url string The URL of the remote repository

However, we could use something a bit more robust, giving more useful feedback. If you care for it, that'd be welcome.

MichaelMure avatar Oct 26 '22 22:10 MichaelMure

The URLs are not clear at all... --url=https:/xxx/gitlab/group/subgroup/repo --base-url https://xxx/gitlab gives me: Error: project validation: wrong token scope ou non-existent project: GET https://xxx/gitlab/api/v4/projects/gitlab/group/subgroup/repo: 404 {message: 404 Project Not Found}

git-bug version: 0.8.0

Rots avatar Mar 06 '24 23:03 Rots

This bot triages untriaged issues and PRs according to the following rules:

  • After 90 days of inactivity, the lifecycle/stale label is applied
  • After 30 days of inactivity since lifecycle/stale was applied, the issue is closed

To remove the stale status, you can:

  • Remove the lifecycle/stale label
  • Comment on this issue

github-actions[bot] avatar Jul 23 '24 03:07 github-actions[bot]