Skip to content

Commit

Permalink
hopefully fix ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
Hermsi1337 committed May 7, 2019
1 parent 2e9eb29 commit 0d3a47e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (

const (
forceUpdateFlag = "force"
httpsOnlyFlag = "https-only"
httpsUsernameFlag = "https-username"
httpsPasswordFlag = "https-password"
sshIdentityFileFlag = "ssh-identity-file"
Expand Down
9 changes: 7 additions & 2 deletions service/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@ func (s *SyncImpl) Resolve(forceUpdate bool) error {
var authProvider helper.AuthProvider
for _, dep := range protodep.Dependencies {

depRepoURL, err := url.Parse(dep.Target)
depRepoURL, err := url.Parse("https://" + dep.Target)
if err != nil {
logger.Error("failed to parse dep Target '%s'", dep.Target)
return err
}

bareDepHostname := depRepoURL.Hostname()
bareDepRepoPath := strings.TrimPrefix(depRepoURL.RawPath, "/")
bareDepRepoPath := strings.TrimPrefix(depRepoURL.Path, "/")
bareDepRepo := bareDepHostname + "/" + bareDepRepoPath

repoURL, err := url.Parse("https://" + bareDepRepo)
Expand All @@ -76,12 +78,15 @@ func (s *SyncImpl) Resolve(forceUpdate bool) error {
repoHostnameWithScheme := repoURL.Scheme + "://" + repoURL.Hostname()
rewritedGitRepo := helper.GitConfig(repoHostnameWithScheme)
if len(rewritedGitRepo) > 0 {
logger.Info("found rewrite in gitconfig for '%s' ...", bareDepRepo)
rewritedGitRepoURL, err := url.Parse(rewritedGitRepo)
if err != nil {
return err
}

dep.Target = rewritedGitRepo + repoURL.Path
logger.Info("... rewriting to '%s'", dep.Target)

if rewritedGitRepoURL.Scheme == "ssh" {
authProvider = s.authProviderSSH
} else {
Expand Down

0 comments on commit 0d3a47e

Please sign in to comment.