@@ -199,7 +199,10 @@ func initRepository(ctx context.Context, u *user_model.User, repo *repo_model.Re
199
199
}
200
200
201
201
// CreateRepositoryDirectly creates a repository for the user/organization.
202
- func CreateRepositoryDirectly (ctx context.Context , doer , owner * user_model.User , opts CreateRepoOptions ) (* repo_model.Repository , error ) {
202
+ // if needsUpdateToReady is true, it will update the repository status to ready when success
203
+ func CreateRepositoryDirectly (ctx context.Context , doer , owner * user_model.User ,
204
+ opts CreateRepoOptions , needsUpdateToReady bool ,
205
+ ) (* repo_model.Repository , error ) {
203
206
if ! doer .CanCreateRepoIn (owner ) {
204
207
return nil , repo_model.ErrReachLimitOfRepo {
205
208
Limit : owner .MaxRepoCreation ,
@@ -243,8 +246,6 @@ func CreateRepositoryDirectly(ctx context.Context, doer, owner *user_model.User,
243
246
ObjectFormatName : opts .ObjectFormatName ,
244
247
}
245
248
246
- needsUpdateStatus := opts .Status != repo_model .RepositoryReady
247
-
248
249
// 1 - create the repository database operations first
249
250
err := db .WithTx (ctx , func (ctx context.Context ) error {
250
251
return createRepositoryInDB (ctx , doer , owner , repo , false )
@@ -318,7 +319,7 @@ func CreateRepositoryDirectly(ctx context.Context, doer, owner *user_model.User,
318
319
}
319
320
320
321
// 7 - update repository status to be ready
321
- if needsUpdateStatus {
322
+ if needsUpdateToReady {
322
323
repo .Status = repo_model .RepositoryReady
323
324
if err = repo_model .UpdateRepositoryCols (ctx , repo , "status" ); err != nil {
324
325
return nil , fmt .Errorf ("UpdateRepositoryCols: %w" , err )
0 commit comments