|
|
@ -6,6 +6,7 @@ package repo |
|
|
|
|
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"net/url" |
|
|
|
"os" |
|
|
|
"path" |
|
|
|
"strings" |
|
|
@ -18,6 +19,7 @@ import ( |
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"code.gitea.io/gitea/modules/migrations" |
|
|
|
"code.gitea.io/gitea/modules/setting" |
|
|
|
"code.gitea.io/gitea/modules/structs" |
|
|
|
"code.gitea.io/gitea/modules/task" |
|
|
|
"code.gitea.io/gitea/modules/util" |
|
|
|
repo_service "code.gitea.io/gitea/services/repository" |
|
|
@ -330,22 +332,29 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
var gitServiceType = structs.PlainGitService |
|
|
|
u, err := url.Parse(form.CloneAddr) |
|
|
|
if err == nil && strings.EqualFold(u.Host, "github.com") { |
|
|
|
gitServiceType = structs.GithubService |
|
|
|
} |
|
|
|
|
|
|
|
var opts = migrations.MigrateOptions{ |
|
|
|
OriginalURL: form.CloneAddr, |
|
|
|
CloneAddr: remoteAddr, |
|
|
|
RepoName: form.RepoName, |
|
|
|
Description: form.Description, |
|
|
|
Private: form.Private || setting.Repository.ForcePrivate, |
|
|
|
Mirror: form.Mirror, |
|
|
|
AuthUsername: form.AuthUsername, |
|
|
|
AuthPassword: form.AuthPassword, |
|
|
|
Wiki: form.Wiki, |
|
|
|
Issues: form.Issues, |
|
|
|
Milestones: form.Milestones, |
|
|
|
Labels: form.Labels, |
|
|
|
Comments: true, |
|
|
|
PullRequests: form.PullRequests, |
|
|
|
Releases: form.Releases, |
|
|
|
OriginalURL: form.CloneAddr, |
|
|
|
GitServiceType: gitServiceType, |
|
|
|
CloneAddr: remoteAddr, |
|
|
|
RepoName: form.RepoName, |
|
|
|
Description: form.Description, |
|
|
|
Private: form.Private || setting.Repository.ForcePrivate, |
|
|
|
Mirror: form.Mirror, |
|
|
|
AuthUsername: form.AuthUsername, |
|
|
|
AuthPassword: form.AuthPassword, |
|
|
|
Wiki: form.Wiki, |
|
|
|
Issues: form.Issues, |
|
|
|
Milestones: form.Milestones, |
|
|
|
Labels: form.Labels, |
|
|
|
Comments: true, |
|
|
|
PullRequests: form.PullRequests, |
|
|
|
Releases: form.Releases, |
|
|
|
} |
|
|
|
if opts.Mirror { |
|
|
|
opts.Issues = false |
|
|
|