Use repo object format name instead of detecting from git repository (#29702)
It's unnecessary to detect the repository object format from git repository. Just use the repository's object format name. (cherry picked from commit 3c6fc25a77c37d50686caa495d27a31dcef7f75f) Conflicts: services/pull/pull.go
This commit is contained in:
parent
32dd02829e
commit
69ebc2f7d8
6 changed files with 9 additions and 29 deletions
|
@ -148,12 +148,7 @@ func RestoreBranchPost(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
objectFormat, err := git.GetObjectFormatOfRepo(ctx, ctx.Repo.Repository.RepoPath())
|
||||
if err != nil {
|
||||
log.Error("RestoreBranch: CreateBranch: %w", err)
|
||||
ctx.Flash.Error(ctx.Tr("repo.branch.restore_failed", deletedBranch.Name))
|
||||
return
|
||||
}
|
||||
objectFormat := git.ObjectFormatFromName(ctx.Repo.Repository.ObjectFormatName)
|
||||
|
||||
// Don't return error below this
|
||||
if err := repo_service.PushUpdate(
|
||||
|
|
|
@ -684,12 +684,7 @@ func TestWebhook(ctx *context.Context) {
|
|||
commit := ctx.Repo.Commit
|
||||
if commit == nil {
|
||||
ghost := user_model.NewGhostUser()
|
||||
objectFormat, err := git.GetObjectFormatOfRepo(ctx, ctx.Repo.Repository.RepoPath())
|
||||
if err != nil {
|
||||
ctx.Flash.Error("GetObjectFormatOfRepo: " + err.Error())
|
||||
ctx.Status(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
objectFormat := git.ObjectFormatFromName(ctx.Repo.Repository.ObjectFormatName)
|
||||
commit = &git.Commit{
|
||||
ID: objectFormat.EmptyObjectID(),
|
||||
Author: ghost.NewGitSig(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue