@ -12,10 +12,10 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/contexttest"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/test"
files_service "code.gitea.io/gitea/services/repository/files"
"github.com/stretchr/testify/assert"
@ -245,12 +245,12 @@ func getExpectedFileResponseForRepofilesUpdate(commitID, filename, lastCommitSHA
func TestChangeRepoFilesForCreate ( t * testing . T ) {
// setup
onGiteaRun ( t , func ( t * testing . T , u * url . URL ) {
ctx , _ := test . MockContext ( t , "user2/repo1" )
ctx , _ := context test. MockContext ( t , "user2/repo1" )
ctx . SetParams ( ":id" , "1" )
test . LoadRepo ( t , ctx , 1 )
test . LoadRepoCommit ( t , ctx )
test . LoadUser ( t , ctx , 2 )
test . LoadGitRepo ( t , ctx )
context test. LoadRepo ( t , ctx , 1 )
context test. LoadRepoCommit ( t , ctx )
context test. LoadUser ( t , ctx , 2 )
context test. LoadGitRepo ( t , ctx )
defer ctx . Repo . GitRepo . Close ( )
repo := ctx . Repo . Repository
@ -282,12 +282,12 @@ func TestChangeRepoFilesForCreate(t *testing.T) {
func TestChangeRepoFilesForUpdate ( t * testing . T ) {
// setup
onGiteaRun ( t , func ( t * testing . T , u * url . URL ) {
ctx , _ := test . MockContext ( t , "user2/repo1" )
ctx , _ := context test. MockContext ( t , "user2/repo1" )
ctx . SetParams ( ":id" , "1" )
test . LoadRepo ( t , ctx , 1 )
test . LoadRepoCommit ( t , ctx )
test . LoadUser ( t , ctx , 2 )
test . LoadGitRepo ( t , ctx )
context test. LoadRepo ( t , ctx , 1 )
context test. LoadRepoCommit ( t , ctx )
context test. LoadUser ( t , ctx , 2 )
context test. LoadGitRepo ( t , ctx )
defer ctx . Repo . GitRepo . Close ( )
repo := ctx . Repo . Repository
@ -316,12 +316,12 @@ func TestChangeRepoFilesForUpdate(t *testing.T) {
func TestChangeRepoFilesForUpdateWithFileMove ( t * testing . T ) {
// setup
onGiteaRun ( t , func ( t * testing . T , u * url . URL ) {
ctx , _ := test . MockContext ( t , "user2/repo1" )
ctx , _ := context test. MockContext ( t , "user2/repo1" )
ctx . SetParams ( ":id" , "1" )
test . LoadRepo ( t , ctx , 1 )
test . LoadRepoCommit ( t , ctx )
test . LoadUser ( t , ctx , 2 )
test . LoadGitRepo ( t , ctx )
context test. LoadRepo ( t , ctx , 1 )
context test. LoadRepoCommit ( t , ctx )
context test. LoadUser ( t , ctx , 2 )
context test. LoadGitRepo ( t , ctx )
defer ctx . Repo . GitRepo . Close ( )
repo := ctx . Repo . Repository
@ -367,12 +367,12 @@ func TestChangeRepoFilesForUpdateWithFileMove(t *testing.T) {
func TestChangeRepoFilesWithoutBranchNames ( t * testing . T ) {
// setup
onGiteaRun ( t , func ( t * testing . T , u * url . URL ) {
ctx , _ := test . MockContext ( t , "user2/repo1" )
ctx , _ := context test. MockContext ( t , "user2/repo1" )
ctx . SetParams ( ":id" , "1" )
test . LoadRepo ( t , ctx , 1 )
test . LoadRepoCommit ( t , ctx )
test . LoadUser ( t , ctx , 2 )
test . LoadGitRepo ( t , ctx )
context test. LoadRepo ( t , ctx , 1 )
context test. LoadRepoCommit ( t , ctx )
context test. LoadUser ( t , ctx , 2 )
context test. LoadGitRepo ( t , ctx )
defer ctx . Repo . GitRepo . Close ( )
repo := ctx . Repo . Repository
@ -403,12 +403,12 @@ func TestChangeRepoFilesForDelete(t *testing.T) {
func testDeleteRepoFiles ( t * testing . T , u * url . URL ) {
// setup
unittest . PrepareTestEnv ( t )
ctx , _ := test . MockContext ( t , "user2/repo1" )
ctx , _ := context test. MockContext ( t , "user2/repo1" )
ctx . SetParams ( ":id" , "1" )
test . LoadRepo ( t , ctx , 1 )
test . LoadRepoCommit ( t , ctx )
test . LoadUser ( t , ctx , 2 )
test . LoadGitRepo ( t , ctx )
context test. LoadRepo ( t , ctx , 1 )
context test. LoadRepoCommit ( t , ctx )
context test. LoadUser ( t , ctx , 2 )
context test. LoadGitRepo ( t , ctx )
defer ctx . Repo . GitRepo . Close ( )
repo := ctx . Repo . Repository
doer := ctx . Doer
@ -442,12 +442,12 @@ func TestChangeRepoFilesForDeleteWithoutBranchNames(t *testing.T) {
func testDeleteRepoFilesWithoutBranchNames ( t * testing . T , u * url . URL ) {
// setup
unittest . PrepareTestEnv ( t )
ctx , _ := test . MockContext ( t , "user2/repo1" )
ctx , _ := context test. MockContext ( t , "user2/repo1" )
ctx . SetParams ( ":id" , "1" )
test . LoadRepo ( t , ctx , 1 )
test . LoadRepoCommit ( t , ctx )
test . LoadUser ( t , ctx , 2 )
test . LoadGitRepo ( t , ctx )
context test. LoadRepo ( t , ctx , 1 )
context test. LoadRepoCommit ( t , ctx )
context test. LoadUser ( t , ctx , 2 )
context test. LoadGitRepo ( t , ctx )
defer ctx . Repo . GitRepo . Close ( )
repo := ctx . Repo . Repository
@ -472,12 +472,12 @@ func testDeleteRepoFilesWithoutBranchNames(t *testing.T, u *url.URL) {
func TestChangeRepoFilesErrors ( t * testing . T ) {
// setup
onGiteaRun ( t , func ( t * testing . T , u * url . URL ) {
ctx , _ := test . MockContext ( t , "user2/repo1" )
ctx , _ := context test. MockContext ( t , "user2/repo1" )
ctx . SetParams ( ":id" , "1" )
test . LoadRepo ( t , ctx , 1 )
test . LoadRepoCommit ( t , ctx )
test . LoadUser ( t , ctx , 2 )
test . LoadGitRepo ( t , ctx )
context test. LoadRepo ( t , ctx , 1 )
context test. LoadRepoCommit ( t , ctx )
context test. LoadUser ( t , ctx , 2 )
context test. LoadGitRepo ( t , ctx )
defer ctx . Repo . GitRepo . Close ( )
repo := ctx . Repo . Repository