Skip to content

Commit 2bd1873

Browse files
committed
test
1 parent b6a426d commit 2bd1873

File tree

27 files changed

+50
-49
lines changed

27 files changed

+50
-49
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

modules/git/repo_commit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ import (
1818

1919
// GetBranchCommitID returns last commit ID string of given branch.
2020
func (repo *Repository) GetBranchCommitID(name string) (string, error) {
21-
return repo.GetRefCommitIDOld(BranchPrefix + name)
21+
return repo.GetRefCommitIDNew(BranchPrefix + name)
2222
}
2323

2424
// GetTagCommitID returns last commit ID string of given tag.
2525
func (repo *Repository) GetTagCommitID(name string) (string, error) {
26-
return repo.GetRefCommitIDOld(TagPrefix + name)
26+
return repo.GetRefCommitIDNew(TagPrefix + name)
2727
}
2828

2929
// GetCommit returns commit object of by ID string.

modules/git/repo_commit_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func TestGetRefCommitID(t *testing.T) {
124124
}
125125

126126
for _, testCase := range testCases {
127-
commitID, err := bareRepo1.GetRefCommitIDOld(testCase.Ref)
127+
commitID, err := bareRepo1.GetRefCommitIDNew(testCase.Ref)
128128
if assert.NoError(t, err) {
129129
assert.Equal(t, testCase.ExpectedCommitID, commitID)
130130
}

modules/git/repo_compare_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func TestReadWritePullHead(t *testing.T) {
9696
defer repo.Close()
9797

9898
// Try to open non-existing Pull
99-
_, err = repo.GetRefCommitIDOld(PullPrefix + "0/head")
99+
_, err = repo.GetRefCommitIDNew(PullPrefix + "0/head")
100100
assert.Error(t, err)
101101

102102
// Write a fake sha1 with only 40 zeros
@@ -111,7 +111,7 @@ func TestReadWritePullHead(t *testing.T) {
111111
}
112112

113113
// Read the file created
114-
headContents, err := repo.GetRefCommitIDOld(PullPrefix + "1/head")
114+
headContents, err := repo.GetRefCommitIDNew(PullPrefix + "1/head")
115115
if err != nil {
116116
assert.NoError(t, err)
117117
return

modules/git/repo_tree_nogogit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (repo *Repository) GetTree(idStr string) (*Tree, error) {
8888
return nil, err
8989
}
9090
if len(idStr) != objectFormat.FullLength() {
91-
res, err := repo.GetRefCommitIDOld(idStr)
91+
res, err := repo.GetRefCommitIDNew(idStr)
9292
if err != nil {
9393
return nil, err
9494
}

modules/indexer/code/gitgrep/gitgrep.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func PerformSearch(ctx context.Context, page int, repoID int64, gitRepo *git.Rep
4242
// TODO: if no branch exists, it reports: exit status 128, fatal: this operation must be run in a work tree.
4343
return nil, 0, fmt.Errorf("git.GrepSearch: %w", err)
4444
}
45-
commitID, err := gitRepo.GetRefCommitIDOld(ref.String())
45+
commitID, err := gitRepo.GetRefCommitIDNew(ref.String())
4646
if err != nil {
4747
return nil, 0, fmt.Errorf("gitRepo.GetRefCommitID: %w", err)
4848
}

routers/api/v1/repo/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ func GetPullRequestFiles(ctx *context.APIContext) {
15671567
return
15681568
}
15691569

1570-
headCommitID, err := baseGitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
1570+
headCommitID, err := baseGitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
15711571
if err != nil {
15721572
ctx.APIErrorInternal(err)
15731573
return

routers/api/v1/repo/pull_review.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func CreatePullReview(ctx *context.APIContext) {
336336
}
337337
defer closer.Close()
338338

339-
headCommitID, err := gitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
339+
headCommitID, err := gitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
340340
if err != nil {
341341
ctx.APIErrorInternal(err)
342342
return
@@ -455,7 +455,7 @@ func SubmitPullReview(ctx *context.APIContext) {
455455
return
456456
}
457457

458-
headCommitID, err := ctx.Repo.GitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
458+
headCommitID, err := ctx.Repo.GitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
459459
if err != nil {
460460
ctx.APIErrorInternal(err)
461461
return

routers/web/repo/pull.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func GetPullDiffStats(ctx *context.Context) {
197197
}
198198

199199
// do not report 500 server error to end users if error occurs, otherwise a PR missing ref won't be able to view.
200-
headCommitID, err := ctx.Repo.GitRepo.GetRefCommitIDOld(pull.GetGitHeadRefName())
200+
headCommitID, err := ctx.Repo.GitRepo.GetRefCommitIDNew(pull.GetGitHeadRefName())
201201
if err != nil {
202202
log.Error("Failed to GetRefCommitID: %v, repo: %v", err, ctx.Repo.Repository.FullName())
203203
return
@@ -219,7 +219,7 @@ func GetMergedBaseCommitID(ctx *context.Context, issue *issues_model.Issue) stri
219219
if pull.MergeBase == "" {
220220
var commitSHA, parentCommit string
221221
// If there is a head or a patch file, and it is readable, grab info
222-
commitSHA, err := ctx.Repo.GitRepo.GetRefCommitIDOld(pull.GetGitHeadRefName())
222+
commitSHA, err := ctx.Repo.GitRepo.GetRefCommitIDNew(pull.GetGitHeadRefName())
223223
if err != nil {
224224
// Head File does not exist, try the patch
225225
commitSHA, err = ctx.Repo.GitRepo.ReadPatchCommit(pull.Index)
@@ -364,7 +364,7 @@ func prepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *pull_
364364
ctx.Data["BaseTarget"] = pull.BaseBranch
365365
ctx.Data["HeadTarget"] = pull.HeadBranch
366366

367-
sha, err := baseGitRepo.GetRefCommitIDOld(pull.GetGitHeadRefName())
367+
sha, err := baseGitRepo.GetRefCommitIDNew(pull.GetGitHeadRefName())
368368
if err != nil {
369369
ctx.ServerError(fmt.Sprintf("GetRefCommitID(%s)", pull.GetGitHeadRefName()), err)
370370
return nil
@@ -422,7 +422,7 @@ func prepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *pull_
422422

423423
if headBranchExist {
424424
if pull.Flow != issues_model.PullRequestFlowGithub {
425-
headBranchSha, err = baseGitRepo.GetRefCommitIDOld(pull.GetGitHeadRefName())
425+
headBranchSha, err = baseGitRepo.GetRefCommitIDNew(pull.GetGitHeadRefName())
426426
} else {
427427
headBranchSha, err = headGitRepo.GetBranchCommitID(pull.HeadBranch)
428428
}
@@ -445,7 +445,7 @@ func prepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *pull_
445445
ctx.Data["GetCommitMessages"] = ""
446446
}
447447

448-
sha, err := baseGitRepo.GetRefCommitIDOld(pull.GetGitHeadRefName())
448+
sha, err := baseGitRepo.GetRefCommitIDNew(pull.GetGitHeadRefName())
449449
if err != nil {
450450
if git.IsErrNotExist(err) {
451451
ctx.Data["IsPullRequestBroken"] = true
@@ -702,7 +702,7 @@ func viewPullFiles(ctx *context.Context, beforeCommitID, afterCommitID string) {
702702
return
703703
}
704704

705-
headCommitID, err := gitRepo.GetRefCommitIDOld(pull.GetGitHeadRefName())
705+
headCommitID, err := gitRepo.GetRefCommitIDNew(pull.GetGitHeadRefName())
706706
if err != nil {
707707
ctx.ServerError("GetRefCommitID", err)
708708
return

0 commit comments

Comments
 (0)