@@ -128,6 +128,7 @@ func ForkRepository(ctx context.Context, doer, owner *user_model.User, opts Fork
128128 }
129129 }()
130130
131+ // 2 - check whether the repository with the same storage exists
131132 var isExist bool
132133 isExist , err = gitrepo .IsRepositoryExist (ctx , repo )
133134 if err != nil {
@@ -144,7 +145,7 @@ func ForkRepository(ctx context.Context, doer, owner *user_model.User, opts Fork
144145 return nil , err
145146 }
146147
147- // 2 - Clone the repository
148+ // 3 - Clone the repository
148149 cloneCmd := git .NewCommand ("clone" , "--bare" )
149150 if opts .SingleBranch != "" {
150151 cloneCmd .AddArguments ("--single-branch" , "--branch" ).AddDynamicArguments (opts .SingleBranch )
@@ -156,17 +157,17 @@ func ForkRepository(ctx context.Context, doer, owner *user_model.User, opts Fork
156157 return nil , fmt .Errorf ("git clone: %w" , err )
157158 }
158159
159- // 3 - Update the repository
160+ // 4 - Update the git repository
160161 if err = updateGitRepoAfterCreate (ctx , repo ); err != nil {
161162 return nil , fmt .Errorf ("updateGitRepoAfterCreate: %w" , err )
162163 }
163164
164- // 4 - Create hooks
165+ // 5 - Create hooks
165166 if err = gitrepo .CreateDelegateHooks (ctx , repo ); err != nil {
166167 return nil , fmt .Errorf ("createDelegateHooks: %w" , err )
167168 }
168169
169- // 5 - Sync the repository branches and tags
170+ // 6 - Sync the repository branches and tags
170171 var gitRepo * git.Repository
171172 gitRepo , err = gitrepo .OpenRepository (ctx , repo )
172173 if err != nil {
@@ -181,7 +182,7 @@ func ForkRepository(ctx context.Context, doer, owner *user_model.User, opts Fork
181182 return nil , fmt .Errorf ("Sync releases from git tags failed: %v" , err )
182183 }
183184
184- // 6 - Update the repository
185+ // 7 - Update the repository
185186 // even if below operations failed, it could be ignored. And they will be retried
186187 if err = repo_module .UpdateRepoSize (ctx , repo ); err != nil {
187188 log .Error ("Failed to update size for repository: %v" , err )
@@ -195,7 +196,7 @@ func ForkRepository(ctx context.Context, doer, owner *user_model.User, opts Fork
195196 return nil , err
196197 }
197198
198- // 7 - update repository status to be ready
199+ // 8 - update repository status to be ready
199200 repo .Status = repo_model .RepositoryReady
200201 if err = repo_model .UpdateRepositoryCols (ctx , repo , "status" ); err != nil {
201202 return nil , fmt .Errorf ("UpdateRepositoryCols: %w" , err )
0 commit comments