Skip to content

Commit f2f99a7

Browse files
authored
Ensure that pusher is not nil preventing panic in push (#13945)
PR #13381 refactored notification actions to call NotifyCreateRef and NotifyDeleteRef in a slightly different manner. This leads to the pusher not being set before the call. This PR ensures that the pusher is updated before the call. Fix #13940 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 160f606 commit f2f99a7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

services/repository/push.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
9797
}
9898
var commits = &repo_module.PushCommits{}
9999
if opts.IsTag() { // If is tag reference {
100+
if pusher == nil || pusher.ID != opts.PusherID {
101+
var err error
102+
if pusher, err = models.GetUserByID(opts.PusherID); err != nil {
103+
return err
104+
}
105+
}
100106
tagName := opts.TagName()
101107
if opts.IsDelRef() {
102108
delTags = append(delTags, tagName)

0 commit comments

Comments
 (0)