Skip to content

Commit ef4dc8a

Browse files
committed
test
1 parent b6a426d commit ef4dc8a

File tree

8 files changed

+14
-13
lines changed

8 files changed

+14
-13
lines changed

.github/workflows/pull-db-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
env:
4242
TAGS: bindata
4343
- name: run tests
44-
run: make test-mssql
44+
run: TEST_LOGGER=console,test,file make test-mssql
4545
timeout-minutes: 50
4646
env:
4747
TAGS: bindata
@@ -77,7 +77,7 @@ jobs:
7777
env:
7878
TAGS: bindata
7979
- name: run tests
80-
run: make test-mssql
80+
run: TEST_LOGGER=console,test,file make test-mssql
8181
timeout-minutes: 50
8282
env:
8383
TAGS: bindata
@@ -109,7 +109,7 @@ jobs:
109109
- name: Add hosts to /etc/hosts
110110
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql devstoreaccount1.azurite.local" | sudo tee -a /etc/hosts'
111111
- run: make deps-backend
112-
- run: make backend
112+
- run: TEST_LOGGER=console,test,file make backend
113113
env:
114114
TAGS: bindata
115115
- name: run tests

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ generate-ini-mssql:
581581

582582
.PHONY: test-mssql
583583
test-mssql: integrations.mssql.test generate-ini-mssql
584-
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./integrations.mssql.test
584+
GITEA_ROOT="$(CURDIR)" GITEA_CONF=tests/mssql.ini ./integrations.mssql.test -test.v
585585

586586
.PHONY: test-mssql\#%
587587
test-mssql\#%: integrations.mssql.test generate-ini-mssql

services/automerge/automerge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func handlePullRequestAutoMerge(pullID int64, sha string) {
188188
}
189189
defer baseGitRepo.Close()
190190

191-
headCommitID, err := baseGitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
191+
headCommitID, err := baseGitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
192192
if err != nil {
193193
log.Error("GetRefCommitID: %v", err)
194194
return

services/automergequeue/automergequeue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func StartPRCheckAndAutoMerge(ctx context.Context, pull *issues_model.PullReques
4040
return
4141
}
4242
defer gitRepo.Close()
43-
commitID, err := gitRepo.GetRefCommitIDNew(pull.GetGitHeadRefName())
43+
commitID, err := gitRepo.GetRefCommitIDOld(pull.GetGitHeadRefName())
4444
if err != nil {
4545
log.Error("GetRefCommitID: %v", err)
4646
return

services/mailer/incoming/incoming_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (h *ReplyHandler) Handle(ctx context.Context, content *MailContent, doer *u
127127
_, err := pull_service.CreateCodeComment(
128128
ctx,
129129
doer,
130-
nil,
130+
nil, // FIXME: INCOMING-MAIL-GIT-REPO: it doesn't seem right to use nil for git repo
131131
issue,
132132
comment.Line,
133133
content.Content,

services/pull/pull.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ func GetSquashMergeCommitMessages(ctx context.Context, pr *issues_model.PullRequ
805805
if pr.Flow == issues_model.PullRequestFlowGithub {
806806
headCommit, err = gitRepo.GetBranchCommit(pr.HeadBranch)
807807
} else {
808-
pr.HeadCommitID, err = gitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
808+
pr.HeadCommitID, err = gitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
809809
if err != nil {
810810
log.Error("Unable to get head commit: %s Error: %v", pr.GetGitHeadRefName(), err)
811811
return ""
@@ -982,7 +982,7 @@ func GetIssuesAllCommitStatus(ctx context.Context, issues issues_model.IssueList
982982

983983
// getAllCommitStatus get pr's commit statuses.
984984
func getAllCommitStatus(ctx context.Context, gitRepo *git.Repository, pr *issues_model.PullRequest) (statuses []*git_model.CommitStatus, lastStatus *git_model.CommitStatus, err error) {
985-
sha, shaErr := gitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
985+
sha, shaErr := gitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
986986
if shaErr != nil {
987987
return nil, nil, shaErr
988988
}
@@ -1032,7 +1032,7 @@ func IsHeadEqualWithBranch(ctx context.Context, pr *issues_model.PullRequest, br
10321032
return false, err
10331033
}
10341034
} else {
1035-
pr.HeadCommitID, err = baseGitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
1035+
pr.HeadCommitID, err = baseGitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
10361036
if err != nil {
10371037
return false, err
10381038
}

services/pull/review.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func createCodeComment(ctx context.Context, doer *user_model.User, repo *repo_mo
259259

260260
// Only fetch diff if comment is review comment
261261
if len(patch) == 0 && reviewID != 0 {
262-
headCommitID, err := gitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
262+
headCommitID, err := gitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
263263
if err != nil {
264264
return nil, fmt.Errorf("GetRefCommitID[%s]: %w", pr.GetGitHeadRefName(), err)
265265
}
@@ -325,7 +325,8 @@ func SubmitReview(ctx context.Context, doer *user_model.User, gitRepo *git.Repos
325325
return nil, nil, ErrSubmitReviewOnClosedPR
326326
}
327327

328-
headCommitID, err := gitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
328+
// FIXME: INCOMING-MAIL-GIT-REPO: the gitRepo can be nil when it is from incoming mail
329+
headCommitID, err := gitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
329330
if err != nil {
330331
return nil, nil, err
331332
}

services/repository/branch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func loadOneBranch(ctx context.Context, repo *repo_model.Repository, dbBranch *g
230230
return nil, fmt.Errorf("OpenRepository: %v", err)
231231
}
232232
defer baseGitRepo.Close()
233-
repoIDToGitRepo[pr.BaseRepoID] = baseGitRepo
233+
repoIDToGitRepo[pr.BaseRepoID] = baseGitRepo // FIXME: it's not right to update the caller's map and inserted a closed git repo into it
234234
}
235235
pullCommit, err := baseGitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
236236
if err != nil && !git.IsErrNotExist(err) {

0 commit comments

Comments
 (0)