]> source.dussan.org Git - gitea.git/commitdiff
A pull-mirror repo should be marked as such on creation (#19295)
authorPeter Gardfjäll <peter.gardfjall.work@gmail.com>
Fri, 1 Apr 2022 14:14:36 +0000 (16:14 +0200)
committerGitHub <noreply@github.com>
Fri, 1 Apr 2022 14:14:36 +0000 (22:14 +0800)
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
modules/repository/create.go

index 385f0f5a6f5fb213c0c3f426601898c3ed16e399..dd66974e0400746e01d046b931ca55aa5bd21cc8 100644 (file)
@@ -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()
 
index 33039d77c28c1f719733cfe3a6ce0a8b011bd5b9..21d45c896e650d90dcdd7b98a5440f56c1d7897a 100644 (file)
@@ -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