Skip to content

Commit

Permalink
revert unnecessary change
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Nov 5, 2024
1 parent 6061683 commit a30ba0a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions services/repository/commitstatus/commitstatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/cache"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/gitrepo"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
Expand Down Expand Up @@ -77,10 +78,16 @@ func CreateCommitStatus(ctx context.Context, repo *repo_model.Repository, creato
}
defer closer.Close()

objectFormat := git.ObjectFormatFromName(repo.ObjectFormatName)

commit, err := gitRepo.GetCommit(sha)
if err != nil {
return fmt.Errorf("GetCommit[%s]: %w", sha, err)
}
if len(sha) != objectFormat.FullLength() {
// use complete commit sha
sha = commit.ID.String()
}

if err := db.WithTx(ctx, func(ctx context.Context) error {
if err := git_model.NewCommitStatus(ctx, git_model.NewCommitStatusOptions{
Expand Down

0 comments on commit a30ba0a

Please sign in to comment.