mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-10 19:32:02 +00:00
feat: Add converting mirror repos to normal to the API (#8932)
- Add `POST /repos/{owner}/{repo}/convert` to the API to allow mirror repositories to be converted to normal repositories. - Resolves forgejo/forgejo#7733 Co-authored-by: Charles Martinot <charles.martinot@protonmail.com> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8932 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: mactynow <mactynow@noreply.codeberg.org> Co-committed-by: mactynow <mactynow@noreply.codeberg.org>
This commit is contained in:
parent
8767613338
commit
0b1942150f
8 changed files with 209 additions and 6 deletions
|
@ -41,3 +41,16 @@ func TestLinkedRepository(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertMirrorToNormalRepo(t *testing.T) {
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
|
||||
repo.IsMirror = true
|
||||
err := repo_model.UpdateRepositoryCols(db.DefaultContext, repo, "is_mirror")
|
||||
|
||||
require.NoError(t, err)
|
||||
|
||||
err = ConvertMirrorToNormalRepo(db.DefaultContext, repo)
|
||||
require.NoError(t, err)
|
||||
assert.False(t, repo.IsMirror)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue