mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 12:49:52 +01:00
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
1 changed files with 15 additions and 16 deletions
|
@ -224,8 +224,7 @@ func generateRepoCommit(ctx context.Context, repo, templateRepo, generateRepo *r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: fix the hash
|
if err := git.InitRepository(ctx, tmpDir, false, templateRepo.ObjectFormatName); err != nil {
|
||||||
if err := git.InitRepository(ctx, tmpDir, false, git.Sha1ObjectFormat.Name()); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,18 +326,19 @@ func (gro GenerateRepoOptions) IsValid() bool {
|
||||||
// GenerateRepository generates a repository from a template
|
// GenerateRepository generates a repository from a template
|
||||||
func GenerateRepository(ctx context.Context, doer, owner *user_model.User, templateRepo *repo_model.Repository, opts GenerateRepoOptions) (_ *repo_model.Repository, err error) {
|
func GenerateRepository(ctx context.Context, doer, owner *user_model.User, templateRepo *repo_model.Repository, opts GenerateRepoOptions) (_ *repo_model.Repository, err error) {
|
||||||
generateRepo := &repo_model.Repository{
|
generateRepo := &repo_model.Repository{
|
||||||
OwnerID: owner.ID,
|
OwnerID: owner.ID,
|
||||||
Owner: owner,
|
Owner: owner,
|
||||||
OwnerName: owner.Name,
|
OwnerName: owner.Name,
|
||||||
Name: opts.Name,
|
Name: opts.Name,
|
||||||
LowerName: strings.ToLower(opts.Name),
|
LowerName: strings.ToLower(opts.Name),
|
||||||
Description: opts.Description,
|
Description: opts.Description,
|
||||||
DefaultBranch: opts.DefaultBranch,
|
DefaultBranch: opts.DefaultBranch,
|
||||||
IsPrivate: opts.Private,
|
IsPrivate: opts.Private,
|
||||||
IsEmpty: !opts.GitContent || templateRepo.IsEmpty,
|
IsEmpty: !opts.GitContent || templateRepo.IsEmpty,
|
||||||
IsFsckEnabled: templateRepo.IsFsckEnabled,
|
IsFsckEnabled: templateRepo.IsFsckEnabled,
|
||||||
TemplateID: templateRepo.ID,
|
TemplateID: templateRepo.ID,
|
||||||
TrustModel: templateRepo.TrustModel,
|
TrustModel: templateRepo.TrustModel,
|
||||||
|
ObjectFormatName: templateRepo.ObjectFormatName,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = CreateRepositoryByExample(ctx, doer, owner, generateRepo, false, false); err != nil {
|
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, generateRepo.ObjectFormatName); err != nil {
|
||||||
if err = CheckInitRepository(ctx, owner.Name, generateRepo.Name, git.Sha1ObjectFormat.Name()); err != nil {
|
|
||||||
return generateRepo, err
|
return generateRepo, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue