Skip to content

Commit b6a426d

Browse files
committed
test
1 parent e7e9a04 commit b6a426d

File tree

10 files changed

+16
-16
lines changed

10 files changed

+16
-16
lines changed

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.GetRefCommitIDNew(testCase.Ref)
127+
commitID, err := bareRepo1.GetRefCommitIDOld(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.GetRefCommitIDNew(PullPrefix + "0/head")
99+
_, err = repo.GetRefCommitIDOld(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.GetRefCommitIDNew(PullPrefix + "1/head")
114+
headContents, err := repo.GetRefCommitIDOld(PullPrefix + "1/head")
115115
if err != nil {
116116
assert.NoError(t, err)
117117
return

services/actions/notifier_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func notify(ctx context.Context, input *notifyInput) error {
166166
ref = git.RefNameFromBranch(input.Repo.DefaultBranch)
167167
}
168168

169-
commitID, err := gitRepo.GetRefCommitIDNew(ref.String())
169+
commitID, err := gitRepo.GetRefCommitIDOld(ref.String())
170170
if err != nil {
171171
return fmt.Errorf("gitRepo.GetRefCommitID: %w", err)
172172
}

services/agit/agit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git.
213213
return nil, fmt.Errorf("unable to load base repository for PR[%d] Error: %w", pr.ID, err)
214214
}
215215

216-
oldCommitID, err := gitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
216+
oldCommitID, err := gitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
217217
if err != nil {
218218
return nil, fmt.Errorf("unable to get ref commit id in base repository for PR[%d] Error: %w", pr.ID, err)
219219
}

services/convert/pull.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func ToAPIPullRequest(ctx context.Context, pr *issues_model.PullRequest, doer *u
170170
}
171171

172172
if pr.Flow == issues_model.PullRequestFlowAGit {
173-
apiPullRequest.Head.Sha, err = gitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
173+
apiPullRequest.Head.Sha, err = gitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
174174
if err != nil {
175175
log.Error("GetRefCommitID[%s]: %v", pr.GetGitHeadRefName(), err)
176176
return nil
@@ -210,7 +210,7 @@ func ToAPIPullRequest(ctx context.Context, pr *issues_model.PullRequest, doer *u
210210
)
211211

212212
if !exist {
213-
headCommitID, err := headGitRepo.GetRefCommitIDNew(apiPullRequest.Head.Ref)
213+
headCommitID, err := headGitRepo.GetRefCommitIDOld(apiPullRequest.Head.Ref)
214214
if err != nil && !git.IsErrNotExist(err) {
215215
log.Error("GetCommit[%s]: %v", pr.HeadBranch, err)
216216
return nil
@@ -450,7 +450,7 @@ func ToAPIPullRequests(ctx context.Context, baseRepo *repo_model.Repository, prs
450450
if pr.Flow == issues_model.PullRequestFlowAGit {
451451
apiPullRequest.Head.Name = ""
452452
}
453-
apiPullRequest.Head.Sha, err = gitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
453+
apiPullRequest.Head.Sha, err = gitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
454454
if err != nil {
455455
log.Error("GetRefCommitID[%s]: %v", pr.GetGitHeadRefName(), err)
456456
}

services/migrations/gitea_uploader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ func (g *GiteaLocalUploader) CreateReviews(ctx context.Context, reviews ...*base
879879
continue
880880
}
881881

882-
headCommitID, err := g.gitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
882+
headCommitID, err := g.gitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
883883
if err != nil {
884884
log.Warn("PR #%d GetRefCommitID[%s] in %s/%s: %v, all review comments will be ignored", pr.Index, pr.GetGitHeadRefName(), g.repoOwner, g.repoName, err)
885885
continue

services/mirror/mirror_pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ func SyncPullMirror(ctx context.Context, repoID int64) bool {
493493

494494
// Create reference
495495
if result.oldCommitID == gitShortEmptySha {
496-
commitID, err := gitRepo.GetRefCommitIDNew(result.refName.String())
496+
commitID, err := gitRepo.GetRefCommitIDOld(result.refName.String())
497497
if err != nil {
498498
log.Error("SyncMirrors [repo: %-v]: unable to GetRefCommitID [ref_name: %s]: %v", m.Repo, result.refName, err)
499499
continue

tests/integration/git_general_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, headBranch string
844844
Message: "Testing commit 1",
845845
})
846846
assert.NoError(t, err)
847-
commit, err = gitRepo.GetRefCommitIDNew("HEAD")
847+
commit, err = gitRepo.GetRefCommitIDOld("HEAD")
848848
assert.NoError(t, err)
849849
})
850850

@@ -916,7 +916,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, headBranch string
916916
Message: "Testing commit 2",
917917
})
918918
assert.NoError(t, err)
919-
commit, err = gitRepo.GetRefCommitIDNew("HEAD")
919+
commit, err = gitRepo.GetRefCommitIDOld("HEAD")
920920
assert.NoError(t, err)
921921
})
922922

tests/integration/git_misc_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ func TestAgitReviewStaleness(t *testing.T) {
226226
assert.NoError(t, err)
227227
defer baseGitRepo.Close()
228228

229-
updatedCommitID, err := baseGitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
229+
updatedCommitID, err := baseGitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
230230
assert.NoError(t, err)
231231
t.Logf("Updated commit ID: %s", updatedCommitID)
232232

tests/integration/pull_merge_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ func TestPullAutoMergeAfterCommitStatusSucceed(t *testing.T) {
842842
// update commit status to success, then it should be merged automatically
843843
baseGitRepo, err := gitrepo.OpenRepository(t.Context(), baseRepo)
844844
assert.NoError(t, err)
845-
sha, err := baseGitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
845+
sha, err := baseGitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
846846
assert.NoError(t, err)
847847
masterCommitID, err := baseGitRepo.GetBranchCommitID("master")
848848
assert.NoError(t, err)
@@ -924,7 +924,7 @@ func TestPullAutoMergeAfterCommitStatusSucceedAndApproval(t *testing.T) {
924924
// update commit status to success, then it should be merged automatically
925925
baseGitRepo, err := gitrepo.OpenRepository(t.Context(), baseRepo)
926926
assert.NoError(t, err)
927-
sha, err := baseGitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
927+
sha, err := baseGitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
928928
assert.NoError(t, err)
929929
masterCommitID, err := baseGitRepo.GetBranchCommitID("master")
930930
assert.NoError(t, err)
@@ -1055,7 +1055,7 @@ func TestPullAutoMergeAfterCommitStatusSucceedAndApprovalForAgitFlow(t *testing.
10551055
// update commit status to success, then it should be merged automatically
10561056
baseGitRepo, err := gitrepo.OpenRepository(t.Context(), baseRepo)
10571057
assert.NoError(t, err)
1058-
sha, err := baseGitRepo.GetRefCommitIDNew(pr.GetGitHeadRefName())
1058+
sha, err := baseGitRepo.GetRefCommitIDOld(pr.GetGitHeadRefName())
10591059
assert.NoError(t, err)
10601060
masterCommitID, err := baseGitRepo.GetBranchCommitID("master")
10611061
assert.NoError(t, err)

0 commit comments

Comments
 (0)