@@ -216,30 +216,12 @@ func NewCommitStatus(opts NewCommitStatusOptions) error {
216
216
opts .CommitStatus .CreatorID = opts .Creator .ID
217
217
opts .CommitStatus .RepoID = opts .Repo .ID
218
218
219
- // Get the next Status Index
220
- var nextIndex int64
221
- lastCommitStatus := & CommitStatus {
222
- SHA : opts .SHA ,
223
- RepoID : opts .Repo .ID ,
224
- }
225
- has , err := sess .Desc ("index" ).Limit (1 ).Get (lastCommitStatus )
226
- if err != nil {
227
- if err := sess .Rollback (); err != nil {
228
- log .Error ("NewCommitStatus: sess.Rollback: %v" , err )
229
- }
230
- return fmt .Errorf ("NewCommitStatus[%s, %s]: %v" , repoPath , opts .SHA , err )
231
- }
232
- if has {
233
- log .Debug ("NewCommitStatus[%s, %s]: found" , repoPath , opts .SHA )
234
- nextIndex = lastCommitStatus .Index
235
- }
236
- opts .CommitStatus .Index = nextIndex + 1
237
- log .Debug ("NewCommitStatus[%s, %s]: %d" , repoPath , opts .SHA , opts .CommitStatus .Index )
219
+ log .Debug ("NewCommitStatus[%s, %s]" , repoPath , opts .SHA )
238
220
239
221
opts .CommitStatus .ContextHash = hashCommitStatusContext (opts .CommitStatus .Context )
240
222
241
223
// Insert new CommitStatus
242
- if _ , err = sess .Insert (opts .CommitStatus ); err != nil {
224
+ if _ , err : = sess .Insert (opts .CommitStatus ); err != nil {
243
225
if err := sess .Rollback (); err != nil {
244
226
log .Error ("Insert CommitStatus: sess.Rollback: %v" , err )
245
227
}
0 commit comments