summaryrefslogtreecommitdiffstats
path: root/routers/repo/repo.go
diff options
context:
space:
mode:
authorJohn Olheiser <john.olheiser@gmail.com>2020-08-27 20:36:37 -0500
committerGitHub <noreply@github.com>2020-08-28 09:36:37 +0800
commit211321fb936683815c4033fdfb9ac46af8a3b357 (patch)
tree13f356084062e1827bda3ba0d1c9f4b4b5c2c799 /routers/repo/repo.go
parented2f6e137be8fe3c85292e8344b5bb5cfb56891d (diff)
downloadgitea-211321fb936683815c4033fdfb9ac46af8a3b357.tar.gz
gitea-211321fb936683815c4033fdfb9ac46af8a3b357.zip
Git migration UX (#12619)
* Initial work Signed-off-by: jolheiser <john.olheiser@gmail.com> * Implementation Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix gitlab and token cloning Signed-off-by: jolheiser <john.olheiser@gmail.com> * Imports and JS Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix test Signed-off-by: jolheiser <john.olheiser@gmail.com> * Linting Signed-off-by: jolheiser <john.olheiser@gmail.com> * Generate swagger Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move mirror toggle and rename options Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers/repo/repo.go')
-rw-r--r--routers/repo/repo.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 27c8ff1e03..71df2d0cb7 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -7,7 +7,6 @@ package repo
import (
"fmt"
- "net/url"
"os"
"path"
"strings"
@@ -269,6 +268,9 @@ func Migrate(ctx *context.Context) {
ctx.Data["pull_requests"] = ctx.Query("pull_requests") == "1"
ctx.Data["releases"] = ctx.Query("releases") == "1"
ctx.Data["LFSActive"] = setting.LFS.StartServer
+ // Plain git should be first
+ ctx.Data["service"] = structs.PlainGitService
+ ctx.Data["Services"] = append([]structs.GitServiceType{structs.PlainGitService}, structs.SupportedFullGitService...)
ctxUser := checkContextUser(ctx, ctx.QueryInt64("org"))
if ctx.Written() {
@@ -316,6 +318,9 @@ func handleMigrateError(ctx *context.Context, owner *models.User, err error, nam
// MigratePost response for migrating from external git repository
func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
ctx.Data["Title"] = ctx.Tr("new_migrate")
+ // Plain git should be first
+ ctx.Data["service"] = structs.PlainGitService
+ ctx.Data["Services"] = append([]structs.GitServiceType{structs.PlainGitService}, structs.SupportedFullGitService...)
ctxUser := checkContextUser(ctx, form.UID)
if ctx.Written() {
@@ -349,15 +354,9 @@ 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,
- GitServiceType: gitServiceType,
+ GitServiceType: structs.GitServiceType(form.Service),
CloneAddr: remoteAddr,
RepoName: form.RepoName,
Description: form.Description,
@@ -365,6 +364,7 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
Mirror: form.Mirror && !setting.Repository.DisableMirrors,
AuthUsername: form.AuthUsername,
AuthPassword: form.AuthPassword,
+ AuthToken: form.AuthToken,
Wiki: form.Wiki,
Issues: form.Issues,
Milestones: form.Milestones,