From e4cf8cfd2744f4e62925e397abd4f6085f5ec941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Gardfj=C3=A4ll?= Date: Fri, 1 Apr 2022 12:57:51 +0200 Subject: [PATCH] A pull-mirror repo should be marked as such on creation 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. --- integrations/mirror_pull_test.go | 1 + modules/repository/create.go | 1 + 2 files changed, 2 insertions(+) diff --git a/integrations/mirror_pull_test.go b/integrations/mirror_pull_test.go index 385f0f5a6f5fb..dd66974e04007 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 33039d77c28c1..21d45c896e650 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