@@ -128,12 +128,6 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
128
128
// Push new branch.
129
129
var l * list.List
130
130
if opts .IsNewRef () {
131
- l , err = newCommit .CommitsBeforeLimit (10 )
132
- if err != nil {
133
- return fmt .Errorf ("newCommit.CommitsBeforeLimit: %v" , err )
134
- }
135
- notification .NotifyCreateRef (pusher , repo , "branch" , opts .RefFullName )
136
- } else {
137
131
if repo .IsEmpty { // Change default branch and empty status only if pushed ref is non-empty branch.
138
132
repo .DefaultBranch = refName
139
133
repo .IsEmpty = false
@@ -150,6 +144,12 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
150
144
}
151
145
}
152
146
147
+ l , err = newCommit .CommitsBeforeLimit (10 )
148
+ if err != nil {
149
+ return fmt .Errorf ("newCommit.CommitsBeforeLimit: %v" , err )
150
+ }
151
+ notification .NotifyCreateRef (pusher , repo , "branch" , opts .RefFullName )
152
+ } else {
153
153
l , err = newCommit .CommitsBeforeUntil (opts .OldCommitID )
154
154
if err != nil {
155
155
return fmt .Errorf ("newCommit.CommitsBeforeUntil: %v" , err )
@@ -170,11 +170,11 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
170
170
}
171
171
}
172
172
173
+ commits = repo_module .ListToPushCommits (l )
173
174
if len (commits .Commits ) > setting .UI .FeedMaxCommitNum {
174
175
commits .Commits = commits .Commits [:setting .UI .FeedMaxCommitNum ]
175
176
}
176
177
commits .CompareURL = repo .ComposeCompareURL (opts .OldCommitID , opts .NewCommitID )
177
- commits = repo_module .ListToPushCommits (l )
178
178
notification .NotifyPushCommits (pusher , repo , opts , commits )
179
179
180
180
if err := repofiles .UpdateIssuesCommit (pusher , repo , commits .Commits , refName ); err != nil {
0 commit comments