]> source.dussan.org Git - gitea.git/commit
Adopt repositories (#12920)
authorzeripath <art27@cantab.net>
Fri, 25 Sep 2020 04:09:23 +0000 (05:09 +0100)
committerGitHub <noreply@github.com>
Fri, 25 Sep 2020 04:09:23 +0000 (07:09 +0300)
commit7a7f56044ae0b94d9f5e733d863821dbe222a395
tree0a6ebe01ce4f48a117598c7b42e189a207314553
parent6fa19a8458e993972be2355e0575a76823a75735
Adopt repositories (#12920)

* Don't automatically delete repository files if they are present

Prior to this PR Gitea would delete any repository files if they are
present during creation or migration. This can in certain circumstances
lead to data-loss and is slightly unpleasant.

This PR provides a mechanism for Gitea to adopt repositories on creation
and otherwise requires an explicit flag for deletion.

PushCreate is slightly different - the create will cause adoption if
that is allowed otherwise it will delete the data if that is allowed.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix tests and migrate overwrite

Signed-off-by: Andrew Thornton <art27@cantab.net>
* as per @lunny

Only offer to adopt or overwrite if the user can do that.

Allow the site administrator to adopt or overwrite in all
circumstances

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use setting.Repository.DefaultBranch for the default branch

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Always set setting.Repository.DefaultBranch

Signed-off-by: Andrew Thornton <art27@cantab.net>
* update swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>
* update templates

Signed-off-by: Andrew Thornton <art27@cantab.net>
* ensure repo closed

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Rewrite of adoption as per @6543 and @lunny

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Apply suggestions from code review

* update swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>
* missing not

Signed-off-by: Andrew Thornton <art27@cantab.net>
* add modals and flash reporting

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Make the unadopted page searchable

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add API

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Handle empty and non-master branched repositories

Signed-off-by: Andrew Thornton <art27@cantab.net>
* placate lint

Signed-off-by: Andrew Thornton <art27@cantab.net>
* remove commented out code

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
31 files changed:
custom/conf/app.example.ini
models/error.go
models/repo.go
models/repo_list.go
models/user.go
modules/git/repo_branch.go
modules/repository/adopt.go [new file with mode: 0644]
modules/repository/create.go
modules/repository/fork.go
modules/repository/generate.go
modules/repository/init.go
modules/setting/repository.go
options/locale/locale_en-US.ini
routers/admin/repos.go
routers/api/v1/admin/adopt.go [new file with mode: 0644]
routers/api/v1/api.go
routers/api/v1/repo/migrate.go
routers/repo/migrate.go
routers/repo/repo.go
routers/repo/setting.go
routers/routes/routes.go
routers/user/setting/adopt.go [new file with mode: 0644]
routers/user/setting/profile.go
services/repository/generate.go
services/repository/repository.go
templates/admin/repo/list.tmpl
templates/admin/repo/unadopted.tmpl [new file with mode: 0644]
templates/swagger/v1_json.tmpl
templates/user/settings/repos.tmpl
web_src/less/_admin.less
web_src/less/_user.less