Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Sep 23, 2021
1 parent 5ada23f commit ebaa9a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions models/commit_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func getNextCommitStatusIndex(repoID int64, sha string) (int64, error) {
defer commiter.Close()

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

ctx, committer, err := db.TxContext()
Expand Down
2 changes: 1 addition & 1 deletion models/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func (pr *PullRequest) SetMerged() (bool, error) {
func NewPullRequest(repo *Repository, issue *Issue, labelIDs []int64, uuids []string, pr *PullRequest) (err error) {
idx, err := db.GetNextResourceIndex("issue_index", repo.ID)
if err != nil {
return fmt.Errorf("generate issue index failed: %v", err)
return fmt.Errorf("generate pull request index failed: %v", err)
}

issue.Index = idx
Expand Down

0 comments on commit ebaa9a6

Please sign in to comment.