aboutsummaryrefslogtreecommitdiffstats
path: root/bridge/gitlab/config.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-23 14:05:03 +0100
committerMichael Muré <batolettre@gmail.com>2020-02-23 14:20:54 +0100
commit0cebe1e57e7e4b03aef77cd11bd4fc683c32afc6 (patch)
tree6c488eef7d39ffcf9226cb1952460b44920ed39e /bridge/gitlab/config.go
parentb3318335986618388637a9d35d68b39633e4548a (diff)
downloadgit-bug-0cebe1e57e7e4b03aef77cd11bd4fc683c32afc6.tar.gz
bridge: record the login used during the configure and use it as default credential
fix #338
Diffstat (limited to 'bridge/gitlab/config.go')
-rw-r--r--bridge/gitlab/config.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/bridge/gitlab/config.go b/bridge/gitlab/config.go
index b730a365..7d0e9a2f 100644
--- a/bridge/gitlab/config.go
+++ b/bridge/gitlab/config.go
@@ -117,6 +117,7 @@ func (g *Gitlab) Configure(repo *cache.RepoCache, params core.BridgeParams) (cor
conf[core.ConfigKeyTarget] = target
conf[confKeyProjectID] = strconv.Itoa(id)
conf[confKeyGitlabBaseUrl] = baseUrl
+ conf[confKeyDefaultLogin] = login
err = g.ValidateConfig(conf)
if err != nil {
@@ -146,6 +147,9 @@ func (g *Gitlab) ValidateConfig(conf core.Configuration) error {
if _, ok := conf[confKeyProjectID]; !ok {
return fmt.Errorf("missing %s key", confKeyProjectID)
}
+ if _, ok := conf[confKeyDefaultLogin]; !ok {
+ return fmt.Errorf("missing %s key", confKeyDefaultLogin)
+ }
return nil
}
@@ -249,12 +253,12 @@ func getValidGitlabRemoteURLs(repo repository.RepoCommon, baseUrl string) ([]str
urls := make([]string, 0, len(remotes))
for _, u := range remotes {
- path, err := getProjectPath(baseUrl, u)
+ p, err := getProjectPath(baseUrl, u)
if err != nil {
continue
}
- urls = append(urls, fmt.Sprintf("%s/%s", baseUrl, path))
+ urls = append(urls, fmt.Sprintf("%s/%s", baseUrl, p))
}
return urls, nil