aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/gitlab/config.go
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-07-19 18:49:28 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-07-23 17:18:04 +0200
commit7726bbdbcf8aa49548ecbcfc323b47b0ec034f54 (patch)
treea075e65a171ffdd78d700355234384376018aa0b /bridge/gitlab/config.go
parent3256b44b1bced56fba551a6d02042e109fe1e4b4 (diff)
downloadgit-bug-7726bbdbcf8aa49548ecbcfc323b47b0ec034f54.tar.gz
bridge/gitlab: add bridge config tests
Diffstat (limited to 'bridge/gitlab/config.go')
-rw-r--r--bridge/gitlab/config.go22
1 files changed, 6 insertions, 16 deletions
diff --git a/bridge/gitlab/config.go b/bridge/gitlab/config.go
index cac2d91e..efef5993 100644
--- a/bridge/gitlab/config.go
+++ b/bridge/gitlab/config.go
@@ -8,7 +8,6 @@ import (
"regexp"
"strconv"
"strings"
- "time"
"github.com/pkg/errors"
"github.com/xanzy/go-gitlab"
@@ -17,16 +16,6 @@ import (
"github.com/MichaelMure/git-bug/repository"
)
-const (
- target = "gitlab"
- gitlabV4Url = "https://gitlab.com/api/v4"
- keyProjectID = "project-id"
- keyTarget = "target"
- keyToken = "token"
-
- defaultTimeout = 60 * time.Second
-)
-
var (
ErrBadProjectURL = errors.New("bad project url")
)
@@ -108,10 +97,10 @@ func (*Gitlab) ValidateConfig(conf core.Configuration) error {
}
func promptToken() (string, error) {
- fmt.Println("You can generate a new token by visiting https://gitlab.com/settings/tokens.")
- fmt.Println("Choose 'Generate new token' and set the necessary access scope for your repository.")
+ fmt.Println("You can generate a new token by visiting https://gitlab.com/profile/personal_access_tokens.")
+ fmt.Println("Choose 'Create personal access token' and set the necessary access scope for your repository.")
fmt.Println()
- fmt.Println("'api' scope access : access scope: to be able to make api calls")
+ fmt.Println("'api' access scope: to be able to make api calls")
fmt.Println()
re, err := regexp.Compile(`^[a-zA-Z0-9\-]{20}`)
@@ -192,13 +181,14 @@ func promptURL(remotes map[string]string) (string, error) {
}
func getProjectPath(url string) (string, error) {
-
cleanUrl := strings.TrimSuffix(url, ".git")
+ cleanUrl = strings.Replace(cleanUrl, "git@", "https://", 1)
objectUrl, err := neturl.Parse(cleanUrl)
if err != nil {
- return "", nil
+ return "", err
}
+ fmt.Println(objectUrl.Path)
return objectUrl.Path[1:], nil
}