Fix logic error from #28138 (#29417)

There's a miss in #28138:

![image](https://github.com/go-gitea/gitea/assets/18380374/b1e0c5fc-0e6e-44ab-9f6e-34bc8ffbe1cc)

https://github.com/go-gitea/gitea/pull/28138/files#diff-2556e62ad7204a230c91927a3f2115e25a2b688240d0ee1de6d34f0277f37dfeR162

@lunny
Not sure about the impact of this, but it will only effect 1.22, and
maybe we should fix it ASAP.

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit f8c1efe944c539396402fb014bbfdb67ba199ef2)
This commit is contained in:
yp05327 2024-02-26 17:10:14 +09:00 committed by Earl Warren
parent d311e5c0b0
commit 480c61432a
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -159,7 +159,7 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) {
} }
// If we've pushed a branch (and not deleted it) // If we've pushed a branch (and not deleted it)
if git.IsEmptyCommitID(newCommitID) && refFullName.IsBranch() { if !git.IsEmptyCommitID(newCommitID) && refFullName.IsBranch() {
// First ensure we have the repository loaded, we're allowed pulls requests and we can get the base repo // First ensure we have the repository loaded, we're allowed pulls requests and we can get the base repo
if repo == nil { if repo == nil {
repo = loadRepository(ctx, ownerName, repoName) repo = loadRepository(ctx, ownerName, repoName)