mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-02 13:00:10 +02:00
ssh clone from all except CodeCommit
This commit is contained in:
1 parent
babd3da49b
commit
9a88d1f9f7
20 files changed
+229
-105
No files matched your search
@@ -40,15 +40,17 @@ type GithubDownloaderV3Factory struct{}
|
||||
|
||||
// New returns a Downloader related to this factory according MigrateOptions
|
||||
func (f *GithubDownloaderV3Factory) 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
|
||||
}
|
||||
if len(info.segments) < 2 {
|
||||
return nil, fmt.Errorf("invalid path: %s", info.repoPath)
|
||||
}
|
||||
|
||||
baseURL := u.Scheme + "://" + u.Host
|
||||
fields := strings.Split(u.Path, "/")
|
||||
oldOwner := fields[1]
|
||||
oldName := strings.TrimSuffix(fields[2], ".git")
|
||||
baseURL := info.apiURL.String()
|
||||
oldOwner := info.segments[0]
|
||||
oldName := strings.TrimSuffix(info.segments[1], ".git")
|
||||
|
||||
log.Trace("Create github downloader BaseURL: %s %s/%s", baseURL, oldOwner, oldName)
|
||||
|
||||
|
||||
Reference in new issue
Block a user