Skip to content

Commit ebaa9a6

Browse files
committed
Fix bug
1 parent 5ada23f commit ebaa9a6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

models/commit_status.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func getNextCommitStatusIndex(repoID int64, sha string) (int64, error) {
9595
defer commiter.Close()
9696

9797
var preIdx int64
98-
_, err = ctx.Engine().SQL("SELECT max_index FROM `commit_status_index` WHERE repo_id = ?", repoID).Get(&preIdx)
98+
_, err = ctx.Engine().SQL("SELECT max_index FROM `commit_status_index` WHERE repo_id = ? AND sha = ?", repoID, sha).Get(&preIdx)
9999
if err != nil {
100100
return 0, err
101101
}
@@ -293,7 +293,7 @@ func NewCommitStatus(opts NewCommitStatusOptions) error {
293293
// Get the next Status Index
294294
idx, err := GetNextCommitStatusIndex(opts.Repo.ID, opts.SHA)
295295
if err != nil {
296-
return fmt.Errorf("generate issue index failed: %v", err)
296+
return fmt.Errorf("generate commit status index failed: %v", err)
297297
}
298298

299299
ctx, committer, err := db.TxContext()

models/pull.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ func (pr *PullRequest) SetMerged() (bool, error) {
450450
func NewPullRequest(repo *Repository, issue *Issue, labelIDs []int64, uuids []string, pr *PullRequest) (err error) {
451451
idx, err := db.GetNextResourceIndex("issue_index", repo.ID)
452452
if err != nil {
453-
return fmt.Errorf("generate issue index failed: %v", err)
453+
return fmt.Errorf("generate pull request index failed: %v", err)
454454
}
455455

456456
issue.Index = idx

0 commit comments

Comments
 (0)