recreate diff
This commit is contained in:
parent
1e1f8e9fde
commit
924d99feeb
|
@ -1,273 +1,111 @@
|
|||
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
|
||||
index 77dc62d4f..27af125f8 100644
|
||||
--- a/modules/setting/setting.go
|
||||
+++ b/modules/setting/setting.go
|
||||
@@ -347,9 +347,9 @@ var (
|
||||
Description string
|
||||
Keywords string
|
||||
}{
|
||||
- Author: "Gitea - Git with a cup of tea",
|
||||
- Description: "Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go",
|
||||
- Keywords: "go,git,self-hosted,gitea",
|
||||
+ Author: "Gitdab",
|
||||
+ Description: "Gitdab is a dabful git site made by people, for people",
|
||||
+ Keywords: "go,git,dab,self-hosted,gitea,gitdab",
|
||||
},
|
||||
}
|
||||
|
||||
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
|
||||
index fe54aa2a3..6fba223ad 100644
|
||||
index fe54aa2a3..6af5a1e13 100644
|
||||
--- a/routers/api/v1/api.go
|
||||
+++ b/routers/api/v1/api.go
|
||||
@@ -431,8 +431,6 @@ func RegisterRoutes(m *macaron.Macaron) {
|
||||
@@ -431,7 +431,7 @@ func RegisterRoutes(m *macaron.Macaron) {
|
||||
m.Combo("/repositories/:id", reqToken()).Get(repo.GetByID)
|
||||
|
||||
m.Group("/repos", func() {
|
||||
- m.Post("/migrate", reqToken(), bind(auth.MigrateRepoForm{}), repo.Migrate)
|
||||
-
|
||||
+ // m.Post("/migrate", reqToken(), bind(auth.MigrateRepoForm{}), repo.Migrate)
|
||||
|
||||
m.Group("/:username/:reponame", func() {
|
||||
m.Combo("").Get(repo.Get).Delete(reqToken(), repo.Delete)
|
||||
m.Group("/hooks", func() {
|
||||
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
|
||||
index e48b100af..d8501a552 100644
|
||||
index e48b100af..016aecc5c 100644
|
||||
--- a/routers/api/v1/repo/repo.go
|
||||
+++ b/routers/api/v1/repo/repo.go
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
- "code.gitea.io/gitea/modules/auth"
|
||||
+ // "code.gitea.io/gitea/modules/auth"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
@@ -318,105 +317,6 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
|
||||
CreateUserRepo(ctx, org, opt)
|
||||
@@ -319,6 +319,7 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
|
||||
}
|
||||
|
||||
-// Migrate migrate remote git repository to gitea
|
||||
-func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
|
||||
- // swagger:operation POST /repos/migrate repository repoMigrate
|
||||
- // ---
|
||||
- // summary: Migrate a remote git repository
|
||||
- // consumes:
|
||||
- // - application/json
|
||||
- // produces:
|
||||
- // - application/json
|
||||
- // parameters:
|
||||
- // - name: body
|
||||
- // in: body
|
||||
- // schema:
|
||||
- // "$ref": "#/definitions/MigrateRepoForm"
|
||||
- // responses:
|
||||
- // "201":
|
||||
- // "$ref": "#/responses/Repository"
|
||||
- ctxUser := ctx.User
|
||||
- // Not equal means context user is an organization,
|
||||
- // or is another user/organization if current user is admin.
|
||||
- if form.UID != ctxUser.ID {
|
||||
- org, err := models.GetUserByID(form.UID)
|
||||
- if err != nil {
|
||||
- if models.IsErrUserNotExist(err) {
|
||||
- ctx.Error(422, "", err)
|
||||
- } else {
|
||||
- ctx.Error(500, "GetUserByID", err)
|
||||
- }
|
||||
- return
|
||||
- }
|
||||
- ctxUser = org
|
||||
- }
|
||||
-
|
||||
- if ctx.HasError() {
|
||||
- ctx.Error(422, "", ctx.GetErrMsg())
|
||||
- return
|
||||
- }
|
||||
-
|
||||
- if !ctx.User.IsAdmin {
|
||||
- if !ctxUser.IsOrganization() && ctx.User.ID != ctxUser.ID {
|
||||
- ctx.Error(403, "", "Given user is not an organization.")
|
||||
- return
|
||||
- }
|
||||
-
|
||||
- if ctxUser.IsOrganization() {
|
||||
- // Check ownership of organization.
|
||||
- isOwner, err := ctxUser.IsOwnedBy(ctx.User.ID)
|
||||
- if err != nil {
|
||||
- ctx.Error(500, "IsOwnedBy", err)
|
||||
- return
|
||||
- } else if !isOwner {
|
||||
- ctx.Error(403, "", "Given user is not owner of organization.")
|
||||
- return
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- remoteAddr, err := form.ParseRemoteAddr(ctx.User)
|
||||
- if err != nil {
|
||||
- if models.IsErrInvalidCloneAddr(err) {
|
||||
- addrErr := err.(models.ErrInvalidCloneAddr)
|
||||
- switch {
|
||||
- case addrErr.IsURLError:
|
||||
- ctx.Error(422, "", err)
|
||||
- case addrErr.IsPermissionDenied:
|
||||
- ctx.Error(422, "", "You are not allowed to import local repositories.")
|
||||
- case addrErr.IsInvalidPath:
|
||||
- ctx.Error(422, "", "Invalid local path, it does not exist or not a directory.")
|
||||
- default:
|
||||
- ctx.Error(500, "ParseRemoteAddr", "Unknown error type (ErrInvalidCloneAddr): "+err.Error())
|
||||
- }
|
||||
- } else {
|
||||
- ctx.Error(500, "ParseRemoteAddr", err)
|
||||
- }
|
||||
- return
|
||||
- }
|
||||
-
|
||||
- repo, err := models.MigrateRepository(ctx.User, ctxUser, models.MigrateRepoOptions{
|
||||
- Name: form.RepoName,
|
||||
- Description: form.Description,
|
||||
- IsPrivate: form.Private || setting.Repository.ForcePrivate,
|
||||
- IsMirror: form.Mirror,
|
||||
- RemoteAddr: remoteAddr,
|
||||
- })
|
||||
- if err != nil {
|
||||
- err = util.URLSanitizedError(err, remoteAddr)
|
||||
- if repo != nil {
|
||||
- if errDelete := models.DeleteRepository(ctx.User, ctxUser.ID, repo.ID); errDelete != nil {
|
||||
- log.Error(4, "DeleteRepository: %v", errDelete)
|
||||
- }
|
||||
- }
|
||||
- ctx.Error(500, "MigrateRepository", err)
|
||||
- return
|
||||
- }
|
||||
-
|
||||
- log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName)
|
||||
- ctx.JSON(201, repo.APIFormat(models.AccessModeAdmin))
|
||||
-}
|
||||
-
|
||||
// Migrate migrate remote git repository to gitea
|
||||
+/*
|
||||
func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
|
||||
// swagger:operation POST /repos/migrate repository repoMigrate
|
||||
// ---
|
||||
@@ -416,6 +417,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
|
||||
log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName)
|
||||
ctx.JSON(201, repo.APIFormat(models.AccessModeAdmin))
|
||||
}
|
||||
+*/
|
||||
|
||||
// Get one repository
|
||||
func Get(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo} repository repoGet
|
||||
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
|
||||
index 236d66bd1..aa6cfe401 100644
|
||||
index 236d66bd1..d5ab721f9 100644
|
||||
--- a/routers/repo/repo.go
|
||||
+++ b/routers/repo/repo.go
|
||||
@@ -20,12 +20,10 @@ import (
|
||||
@@ -20,12 +20,12 @@ import (
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
- "code.gitea.io/gitea/modules/util"
|
||||
+ // "code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
||||
const (
|
||||
tplCreate base.TplName = "repo/create"
|
||||
- tplMigrate base.TplName = "repo/migrate"
|
||||
+ // tplMigrate base.TplName = "repo/migrate"
|
||||
)
|
||||
|
||||
// MustBeNotBare render when a repo is a bare git dir
|
||||
@@ -190,95 +188,6 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
|
||||
@@ -189,7 +189,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
|
||||
|
||||
handleCreateError(ctx, ctxUser, err, "CreatePost", tplCreate, &form)
|
||||
}
|
||||
-
|
||||
+/*
|
||||
// Migrate render migration of repository page
|
||||
func Migrate(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("new_migrate")
|
||||
@@ -278,7 +278,7 @@ func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
|
||||
|
||||
-// Migrate render migration of repository page
|
||||
-func Migrate(ctx *context.Context) {
|
||||
- ctx.Data["Title"] = ctx.Tr("new_migrate")
|
||||
- ctx.Data["private"] = getRepoPrivate(ctx)
|
||||
- ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate
|
||||
- ctx.Data["mirror"] = ctx.Query("mirror") == "1"
|
||||
- ctx.Data["LFSActive"] = setting.LFS.StartServer
|
||||
-
|
||||
- ctxUser := checkContextUser(ctx, ctx.QueryInt64("org"))
|
||||
- if ctx.Written() {
|
||||
- return
|
||||
- }
|
||||
- ctx.Data["ContextUser"] = ctxUser
|
||||
-
|
||||
- ctx.HTML(200, tplMigrate)
|
||||
-}
|
||||
-
|
||||
-// MigratePost response for migrating from external git repository
|
||||
-func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
|
||||
- ctx.Data["Title"] = ctx.Tr("new_migrate")
|
||||
-
|
||||
- ctxUser := checkContextUser(ctx, form.UID)
|
||||
- if ctx.Written() {
|
||||
- return
|
||||
- }
|
||||
- ctx.Data["ContextUser"] = ctxUser
|
||||
-
|
||||
- if ctx.HasError() {
|
||||
- ctx.HTML(200, tplMigrate)
|
||||
- return
|
||||
- }
|
||||
-
|
||||
- remoteAddr, err := form.ParseRemoteAddr(ctx.User)
|
||||
- if err != nil {
|
||||
- if models.IsErrInvalidCloneAddr(err) {
|
||||
- ctx.Data["Err_CloneAddr"] = true
|
||||
- addrErr := err.(models.ErrInvalidCloneAddr)
|
||||
- switch {
|
||||
- case addrErr.IsURLError:
|
||||
- ctx.RenderWithErr(ctx.Tr("form.url_error"), tplMigrate, &form)
|
||||
- case addrErr.IsPermissionDenied:
|
||||
- ctx.RenderWithErr(ctx.Tr("repo.migrate.permission_denied"), tplMigrate, &form)
|
||||
- case addrErr.IsInvalidPath:
|
||||
- ctx.RenderWithErr(ctx.Tr("repo.migrate.invalid_local_path"), tplMigrate, &form)
|
||||
- default:
|
||||
- ctx.ServerError("Unknown error", err)
|
||||
- }
|
||||
- } else {
|
||||
- ctx.ServerError("ParseRemoteAddr", err)
|
||||
- }
|
||||
- return
|
||||
- }
|
||||
-
|
||||
- repo, err := models.MigrateRepository(ctx.User, ctxUser, models.MigrateRepoOptions{
|
||||
- Name: form.RepoName,
|
||||
- Description: form.Description,
|
||||
- IsPrivate: form.Private || setting.Repository.ForcePrivate,
|
||||
- IsMirror: form.Mirror,
|
||||
- RemoteAddr: remoteAddr,
|
||||
- })
|
||||
- if err == nil {
|
||||
- log.Trace("Repository migrated [%d]: %s/%s", repo.ID, ctxUser.Name, form.RepoName)
|
||||
- ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + form.RepoName)
|
||||
- return
|
||||
- }
|
||||
-
|
||||
- // remoteAddr may contain credentials, so we sanitize it
|
||||
- err = util.URLSanitizedError(err, remoteAddr)
|
||||
-
|
||||
- if repo != nil {
|
||||
- if errDelete := models.DeleteRepository(ctx.User, ctxUser.ID, repo.ID); errDelete != nil {
|
||||
- log.Error(4, "DeleteRepository: %v", errDelete)
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if strings.Contains(err.Error(), "Authentication failed") ||
|
||||
- strings.Contains(err.Error(), "could not read Username") {
|
||||
- ctx.Data["Err_Auth"] = true
|
||||
- ctx.RenderWithErr(ctx.Tr("form.auth_failed", err.Error()), tplMigrate, &form)
|
||||
- return
|
||||
- } else if strings.Contains(err.Error(), "fatal:") {
|
||||
- ctx.Data["Err_CloneAddr"] = true
|
||||
- ctx.RenderWithErr(ctx.Tr("repo.migrate.failed", err.Error()), tplMigrate, &form)
|
||||
- return
|
||||
- }
|
||||
-
|
||||
- handleCreateError(ctx, ctxUser, err, "MigratePost", tplMigrate, &form)
|
||||
-}
|
||||
handleCreateError(ctx, ctxUser, err, "MigratePost", tplMigrate, &form)
|
||||
}
|
||||
-
|
||||
+*/
|
||||
// Action response for actions to a repository
|
||||
func Action(ctx *context.Context) {
|
||||
var err error
|
||||
diff --git a/routers/routes/routes.go b/routers/routes/routes.go
|
||||
index 4ca421065..859e54981 100644
|
||||
index 4ca421065..38a322479 100644
|
||||
--- a/routers/routes/routes.go
|
||||
+++ b/routers/routes/routes.go
|
||||
@@ -455,8 +455,6 @@ func RegisterRoutes(m *macaron.Macaron) {
|
||||
@@ -455,8 +455,8 @@ func RegisterRoutes(m *macaron.Macaron) {
|
||||
m.Group("/repo", func() {
|
||||
m.Get("/create", repo.Create)
|
||||
m.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost)
|
||||
- m.Get("/migrate", repo.Migrate)
|
||||
- m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost)
|
||||
+ // m.Get("/migrate", repo.Migrate)
|
||||
+ // m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost)
|
||||
m.Group("/fork", func() {
|
||||
m.Combo("/:repoid").Get(repo.Fork).
|
||||
Post(bindIgnErr(auth.CreateRepoForm{}), repo.ForkPost)
|
||||
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
|
||||
index 77dc62d4f..fa00376a4 100644
|
||||
--- a/modules/setting/setting.go
|
||||
+++ b/modules/setting/setting.go
|
||||
@@ -347,9 +347,9 @@ var (
|
||||
Description string
|
||||
Keywords string
|
||||
}{
|
||||
- Author: "Gitea - Git with a cup of tea",
|
||||
- Description: "Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go",
|
||||
- Keywords: "go,git,self-hosted,gitea",
|
||||
+ Author: "Gitdab",
|
||||
+ Description: "Gitdab is a dabful git site made by people, for people",
|
||||
+ Keywords: "go,git,gitdab,dab,self-hosted,gitea",
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue