ssh clone from all except CodeCommit

This commit is contained in:
pomidorry committed 2026-06-09 00:12:31 +03:00
1 parent babd3da49b
commit 9a88d1f9f7
20 files changed
+229 -105

No files matched your search

+7 -10
View File
@@ -33,22 +33,19 @@ type CodebaseDownloaderFactory struct{}
// New returns a downloader related to this factory according MigrateOptions
func (f *CodebaseDownloaderFactory) New(ctx context.Context, opts base.MigrateOptions) (base.Downloader, error) {
u, err := url.Parse(opts.CloneAddr)
info, err := parseServiceCloneURL(opts.CloneAddr)
if err != nil {
return nil, err
}
u.User = nil
fields := strings.Split(strings.Trim(u.Path, "/"), "/")
if len(fields) != 2 {
return nil, fmt.Errorf("invalid path: %s", u.Path)
if len(info.segments) != 2 {
return nil, fmt.Errorf("invalid path: %s", info.repoPath)
}
project := fields[0]
repoName := strings.TrimSuffix(fields[1], ".git")
project := info.segments[0]
repoName := strings.TrimSuffix(info.segments[1], ".git")
log.Trace("Create Codebase downloader. BaseURL: %v RepoName: %s", u, repoName)
log.Trace("Create Codebase downloader. BaseURL: %v RepoName: %s", info.apiURL, repoName)
return NewCodebaseDownloader(ctx, u, project, repoName, opts.AuthUsername, opts.AuthPassword), nil
return NewCodebaseDownloader(ctx, info.apiURL, project, repoName, opts.AuthUsername, opts.AuthPassword), nil
}
// GitServiceType returns the type of git service