aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter GardfjÀll <peter.gardfjall.work@gmail.com>2022-04-01 16:14:36 +0200
committerGitHub <noreply@github.com>2022-04-01 22:14:36 +0800
commit58c9d12933236c57be958a7e09b8049712624c60 (patch)
treeb9aadb6b3b693bf3f86a5693c50ef36de33996dc
parent65f17bfc31f0f2659978d4d1d5ff825146c53a4d (diff)
downloadgitea-58c9d12933236c57be958a7e09b8049712624c60.tar.gz
gitea-58c9d12933236c57be958a7e09b8049712624c60.zip
A pull-mirror repo should be marked as such on creation (#19295)
Right now, a pull-mirror repo does not get marked as such until *after* the mirroring completes. In the meantime, it will show up (in API and UI) as a regular repo.
-rw-r--r--integrations/mirror_pull_test.go1
-rw-r--r--modules/repository/create.go1
2 files changed, 2 insertions, 0 deletions
diff --git a/integrations/mirror_pull_test.go b/integrations/mirror_pull_test.go
index 385f0f5a6f..dd66974e04 100644
--- a/integrations/mirror_pull_test.go
+++ b/integrations/mirror_pull_test.go
@@ -46,6 +46,7 @@ func TestMirrorPull(t *testing.T) {
Status: repo_model.RepositoryBeingMigrated,
})
assert.NoError(t, err)
+ assert.True(t, mirrorRepo.IsMirror, "expected pull-mirror repo to be marked as a mirror immediately after its creation")
ctx := context.Background()
diff --git a/modules/repository/create.go b/modules/repository/create.go
index 33039d77c2..21d45c896e 100644
--- a/modules/repository/create.go
+++ b/modules/repository/create.go
@@ -54,6 +54,7 @@ func CreateRepository(doer, u *user_model.User, opts models.CreateRepoOptions) (
Status: opts.Status,
IsEmpty: !opts.AutoInit,
TrustModel: opts.TrustModel,
+ IsMirror: opts.IsMirror,
}
var rollbackRepo *repo_model.Repository