Fix bug for generated repository object format (#28969)
A repository generated from a template repository should have the same git ObjectFormat.
This commit is contained in:
parent
dfc1ae15b6
commit
34633d85f1
|
@ -224,8 +224,7 @@ func generateRepoCommit(ctx context.Context, repo, templateRepo, generateRepo *r
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: fix the hash
|
||||
if err := git.InitRepository(ctx, tmpDir, false, git.Sha1ObjectFormat.Name()); err != nil {
|
||||
if err := git.InitRepository(ctx, tmpDir, false, templateRepo.ObjectFormatName); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -339,6 +338,7 @@ func GenerateRepository(ctx context.Context, doer, owner *user_model.User, templ
|
|||
IsFsckEnabled: templateRepo.IsFsckEnabled,
|
||||
TemplateID: templateRepo.ID,
|
||||
TrustModel: templateRepo.TrustModel,
|
||||
ObjectFormatName: templateRepo.ObjectFormatName,
|
||||
}
|
||||
|
||||
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
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME - fix the hash
|
||||
if err = CheckInitRepository(ctx, owner.Name, generateRepo.Name, git.Sha1ObjectFormat.Name()); err != nil {
|
||||
if err = CheckInitRepository(ctx, owner.Name, generateRepo.Name, generateRepo.ObjectFormatName); err != nil {
|
||||
return generateRepo, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue