mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 02:08:36 +00:00
Move push commits from models to modules/repository (#9370)
* Move push commits from models to modules/repository * fix test * fix test * fix test * fix test * fix test Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/repository"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -34,8 +35,8 @@ func TestCommitRepoAction(t *testing.T) {
|
||||
RefFullName: "refName",
|
||||
OldCommitID: "oldCommitID",
|
||||
NewCommitID: "newCommitID",
|
||||
Commits: &models.PushCommits{
|
||||
Commits: []*models.PushCommit{
|
||||
Commits: &repository.PushCommits{
|
||||
Commits: []*repository.PushCommit{
|
||||
{
|
||||
Sha1: "69554a6",
|
||||
CommitterEmail: "user2@example.com",
|
||||
@@ -68,7 +69,7 @@ func TestCommitRepoAction(t *testing.T) {
|
||||
RefFullName: git.TagPrefix + "v1.1",
|
||||
OldCommitID: git.EmptySHA,
|
||||
NewCommitID: "newCommitID",
|
||||
Commits: &models.PushCommits{},
|
||||
Commits: &repository.PushCommits{},
|
||||
},
|
||||
action: models.Action{
|
||||
OpType: models.ActionPushTag,
|
||||
@@ -82,7 +83,7 @@ func TestCommitRepoAction(t *testing.T) {
|
||||
RefFullName: git.TagPrefix + "v1.1",
|
||||
OldCommitID: "oldCommitID",
|
||||
NewCommitID: git.EmptySHA,
|
||||
Commits: &models.PushCommits{},
|
||||
Commits: &repository.PushCommits{},
|
||||
},
|
||||
action: models.Action{
|
||||
OpType: models.ActionDeleteTag,
|
||||
@@ -96,7 +97,7 @@ func TestCommitRepoAction(t *testing.T) {
|
||||
RefFullName: git.BranchPrefix + "feature/1",
|
||||
OldCommitID: "oldCommitID",
|
||||
NewCommitID: git.EmptySHA,
|
||||
Commits: &models.PushCommits{},
|
||||
Commits: &repository.PushCommits{},
|
||||
},
|
||||
action: models.Action{
|
||||
OpType: models.ActionDeleteBranch,
|
||||
@@ -127,7 +128,7 @@ func TestCommitRepoAction(t *testing.T) {
|
||||
|
||||
func TestUpdateIssuesCommit(t *testing.T) {
|
||||
assert.NoError(t, models.PrepareTestDatabase())
|
||||
pushCommits := []*models.PushCommit{
|
||||
pushCommits := []*repository.PushCommit{
|
||||
{
|
||||
Sha1: "abcdef1",
|
||||
CommitterEmail: "user2@example.com",
|
||||
@@ -174,7 +175,7 @@ func TestUpdateIssuesCommit(t *testing.T) {
|
||||
models.CheckConsistencyFor(t, &models.Action{})
|
||||
|
||||
// Test that push to a non-default branch closes no issue.
|
||||
pushCommits = []*models.PushCommit{
|
||||
pushCommits = []*repository.PushCommit{
|
||||
{
|
||||
Sha1: "abcdef1",
|
||||
CommitterEmail: "user2@example.com",
|
||||
@@ -203,7 +204,7 @@ func TestUpdateIssuesCommit(t *testing.T) {
|
||||
|
||||
func TestUpdateIssuesCommit_Colon(t *testing.T) {
|
||||
assert.NoError(t, models.PrepareTestDatabase())
|
||||
pushCommits := []*models.PushCommit{
|
||||
pushCommits := []*repository.PushCommit{
|
||||
{
|
||||
Sha1: "abcdef2",
|
||||
CommitterEmail: "user2@example.com",
|
||||
@@ -231,7 +232,7 @@ func TestUpdateIssuesCommit_Issue5957(t *testing.T) {
|
||||
user := models.AssertExistsAndLoadBean(t, &models.User{ID: 2}).(*models.User)
|
||||
|
||||
// Test that push to a non-default branch closes an issue.
|
||||
pushCommits := []*models.PushCommit{
|
||||
pushCommits := []*repository.PushCommit{
|
||||
{
|
||||
Sha1: "abcdef1",
|
||||
CommitterEmail: "user2@example.com",
|
||||
@@ -266,7 +267,7 @@ func TestUpdateIssuesCommit_AnotherRepo(t *testing.T) {
|
||||
|
||||
// Test that a push to default branch closes issue in another repo
|
||||
// If the user also has push permissions to that repo
|
||||
pushCommits := []*models.PushCommit{
|
||||
pushCommits := []*repository.PushCommit{
|
||||
{
|
||||
Sha1: "abcdef1",
|
||||
CommitterEmail: "user2@example.com",
|
||||
@@ -301,7 +302,7 @@ func TestUpdateIssuesCommit_AnotherRepoNoPermission(t *testing.T) {
|
||||
|
||||
// Test that a push with close reference *can not* close issue
|
||||
// If the commiter doesn't have push rights in that repo
|
||||
pushCommits := []*models.PushCommit{
|
||||
pushCommits := []*repository.PushCommit{
|
||||
{
|
||||
Sha1: "abcdef3",
|
||||
CommitterEmail: "user10@example.com",
|
||||
|
Reference in New Issue
Block a user