@@ -224,8 +224,7 @@ func generateRepoCommit(ctx context.Context, repo, templateRepo, generateRepo *r
224224 }
225225 }
226226
227- // FIXME: fix the hash
228- if err := git .InitRepository (ctx , tmpDir , false , git .Sha1ObjectFormat .Name ()); err != nil {
227+ if err := git .InitRepository (ctx , tmpDir , false , templateRepo .ObjectFormatName ); err != nil {
229228 return err
230229 }
231230
@@ -327,18 +326,19 @@ func (gro GenerateRepoOptions) IsValid() bool {
327326// GenerateRepository generates a repository from a template
328327func GenerateRepository (ctx context.Context , doer , owner * user_model.User , templateRepo * repo_model.Repository , opts GenerateRepoOptions ) (_ * repo_model.Repository , err error ) {
329328 generateRepo := & repo_model.Repository {
330- OwnerID : owner .ID ,
331- Owner : owner ,
332- OwnerName : owner .Name ,
333- Name : opts .Name ,
334- LowerName : strings .ToLower (opts .Name ),
335- Description : opts .Description ,
336- DefaultBranch : opts .DefaultBranch ,
337- IsPrivate : opts .Private ,
338- IsEmpty : ! opts .GitContent || templateRepo .IsEmpty ,
339- IsFsckEnabled : templateRepo .IsFsckEnabled ,
340- TemplateID : templateRepo .ID ,
341- TrustModel : templateRepo .TrustModel ,
329+ OwnerID : owner .ID ,
330+ Owner : owner ,
331+ OwnerName : owner .Name ,
332+ Name : opts .Name ,
333+ LowerName : strings .ToLower (opts .Name ),
334+ Description : opts .Description ,
335+ DefaultBranch : opts .DefaultBranch ,
336+ IsPrivate : opts .Private ,
337+ IsEmpty : ! opts .GitContent || templateRepo .IsEmpty ,
338+ IsFsckEnabled : templateRepo .IsFsckEnabled ,
339+ TemplateID : templateRepo .ID ,
340+ TrustModel : templateRepo .TrustModel ,
341+ ObjectFormatName : templateRepo .ObjectFormatName ,
342342 }
343343
344344 if err = CreateRepositoryByExample (ctx , doer , owner , generateRepo , false , false ); err != nil {
@@ -358,8 +358,7 @@ func GenerateRepository(ctx context.Context, doer, owner *user_model.User, templ
358358 }
359359 }
360360
361- // FIXME - fix the hash
362- if err = CheckInitRepository (ctx , owner .Name , generateRepo .Name , git .Sha1ObjectFormat .Name ()); err != nil {
361+ if err = CheckInitRepository (ctx , owner .Name , generateRepo .Name , generateRepo .ObjectFormatName ); err != nil {
363362 return generateRepo , err
364363 }
365364
0 commit comments