Skip to content

Commit

Permalink
Fix test mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Oct 5, 2020
1 parent 1fc9ae2 commit 06bfd67
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions services/repository/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func pushUpdates(optsList []*PushUpdateOptions) error {
branch := opts.BranchName()
if !opts.IsDelRef() {
log.Trace("TriggerTask '%s/%s' by %s", repo.Name, branch, pusher.Name)
pull_service.AddTestPullRequestTask(pusher, repo.ID, branch, true, opts.OldCommitID, opts.NewCommitID)
go pull_service.AddTestPullRequestTask(pusher, repo.ID, branch, true, opts.OldCommitID, opts.NewCommitID)

newCommit, err := gitRepo.GetCommit(opts.NewCommitID)
if err != nil {
Expand All @@ -241,26 +241,26 @@ func pushUpdates(optsList []*PushUpdateOptions) error {
if err != nil {
return fmt.Errorf("newCommit.CommitsBeforeUntil: %v", err)
}
}

commits = repo_module.ListToPushCommits(l)
isForce, err := isForcePush(repo.RepoPath(), opts)
if err != nil {
log.Error("isForcePush %s/%s failed: %v", repo.ID, branch, err)
}

if err = models.RemoveDeletedBranch(repo.ID, branch); err != nil {
log.Error("models.RemoveDeletedBranch %s/%s failed: %v", repo.ID, branch, err)
}
if isForce {
log.Trace("Push %s is a force push", opts.NewCommitID)

isForce, err := isForcePush(repo.RepoPath(), opts)
if err != nil {
log.Error("isForcePush %s/%s failed: %v", repo.ID, branch, err)
cache.Remove(repo.GetCommitsCountCacheKey(opts.RefName(), true))
} else {
// TODO: increment update the commit count cache but not remove
cache.Remove(repo.GetCommitsCountCacheKey(opts.RefName(), true))
}
}

if isForce {
log.Trace("Push %s is a force push", opts.NewCommitID)
commits = repo_module.ListToPushCommits(l)

cache.Remove(repo.GetCommitsCountCacheKey(opts.RefName(), true))
} else {
// TODO: increment update the commit count cache but not remove
cache.Remove(repo.GetCommitsCountCacheKey(opts.RefName(), true))
if err = models.RemoveDeletedBranch(repo.ID, branch); err != nil {
log.Error("models.RemoveDeletedBranch %s/%s failed: %v", repo.ID, branch, err)
}

// Cache for big repository
Expand Down

0 comments on commit 06bfd67

Please sign in to comment.