mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 10:18:38 +00:00
Fix incorrect ref commit ID usage (#33331)
After the RefName refactoring, the `ctx.Repo.CommitID` is only set when there is a `RepoRefByType` middleware. Many handlers do not use that middleware and they only use "default branch"
This commit is contained in:
@@ -654,6 +654,8 @@ func TestWebhook(ctx *context.Context) {
|
||||
}
|
||||
|
||||
// Grab latest commit or fake one if it's empty repository.
|
||||
// Note: in old code, the "ctx.Repo.Commit" is the last commit of the default branch.
|
||||
// New code doesn't set that commit, so it always uses the fake commit to test webhook.
|
||||
commit := ctx.Repo.Commit
|
||||
if commit == nil {
|
||||
ghost := user_model.NewGhostUser()
|
||||
|
Reference in New Issue
Block a user