@ -95,7 +95,7 @@ func TestPullMerge(t *testing.T) {
hookTasksLenBefore := len ( hookTasks )
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFile ( t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited)\n" )
resp := testPullCreate ( t , session , "user1" , "repo1" , false , "master" , "master" , "This is a pull title" )
@ -117,7 +117,7 @@ func TestPullRebase(t *testing.T) {
hookTasksLenBefore := len ( hookTasks )
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFile ( t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited)\n" )
resp := testPullCreate ( t , session , "user1" , "repo1" , false , "master" , "master" , "This is a pull title" )
@ -139,7 +139,7 @@ func TestPullRebaseMerge(t *testing.T) {
hookTasksLenBefore := len ( hookTasks )
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFile ( t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited)\n" )
resp := testPullCreate ( t , session , "user1" , "repo1" , false , "master" , "master" , "This is a pull title" )
@ -161,7 +161,7 @@ func TestPullSquash(t *testing.T) {
hookTasksLenBefore := len ( hookTasks )
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFile ( t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited)\n" )
testEditFile ( t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited!)\n" )
@ -180,7 +180,7 @@ func TestPullSquash(t *testing.T) {
func TestPullCleanUpAfterMerge ( t * testing . T ) {
onGiteaRun ( t , func ( t * testing . T , giteaURL * url . URL ) {
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFileToNewBranch ( t , session , "user1" , "repo1" , "master" , "feature/test" , "README.md" , "Hello, World (Edited - TestPullCleanUpAfterMerge)\n" )
resp := testPullCreate ( t , session , "user1" , "repo1" , false , "master" , "feature/test" , "This is a pull title" )
@ -215,7 +215,7 @@ func TestPullCleanUpAfterMerge(t *testing.T) {
func TestCantMergeWorkInProgress ( t * testing . T ) {
onGiteaRun ( t , func ( t * testing . T , giteaURL * url . URL ) {
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFile ( t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited)\n" )
resp := testPullCreate ( t , session , "user1" , "repo1" , false , "master" , "master" , "[wip] This is a pull title" )
@ -234,7 +234,7 @@ func TestCantMergeWorkInProgress(t *testing.T) {
func TestCantMergeConflict ( t * testing . T ) {
onGiteaRun ( t , func ( t * testing . T , giteaURL * url . URL ) {
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFileToNewBranch ( t , session , "user1" , "repo1" , "master" , "conflict" , "README.md" , "Hello, World (Edited Once)\n" )
testEditFileToNewBranch ( t , session , "user1" , "repo1" , "master" , "base" , "README.md" , "Hello, World (Edited Twice)\n" )
@ -280,7 +280,7 @@ func TestCantMergeConflict(t *testing.T) {
func TestCantMergeUnrelated ( t * testing . T ) {
onGiteaRun ( t , func ( t * testing . T , giteaURL * url . URL ) {
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFileToNewBranch ( t , session , "user1" , "repo1" , "master" , "base" , "README.md" , "Hello, World (Edited Twice)\n" )
// Now we want to create a commit on a branch that is totally unrelated to our current head
@ -375,7 +375,7 @@ func TestCantMergeUnrelated(t *testing.T) {
func TestFastForwardOnlyMerge ( t * testing . T ) {
onGiteaRun ( t , func ( t * testing . T , giteaURL * url . URL ) {
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFileToNewBranch ( t , session , "user1" , "repo1" , "master" , "update" , "README.md" , "Hello, World 2\n" )
// Use API to create a pr from update to master
@ -416,7 +416,7 @@ func TestFastForwardOnlyMerge(t *testing.T) {
func TestCantFastForwardOnlyMergeDiverging ( t * testing . T ) {
onGiteaRun ( t , func ( t * testing . T , giteaURL * url . URL ) {
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFileToNewBranch ( t , session , "user1" , "repo1" , "master" , "diverging" , "README.md" , "Hello, World diverged\n" )
testEditFile ( t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World 2\n" )
@ -539,7 +539,7 @@ func TestPullRetargetChildOnBranchDelete(t *testing.T) {
onGiteaRun ( t , func ( t * testing . T , giteaURL * url . URL ) {
session := loginUser ( t , "user1" )
testEditFileToNewBranch ( t , session , "user2" , "repo1" , "master" , "base-pr" , "README.md" , "Hello, World\n(Edited - TestPullRetargetOnCleanup - base PR)\n" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFileToNewBranch ( t , session , "user1" , "repo1" , "base-pr" , "child-pr" , "README.md" , "Hello, World\n(Edited - TestPullRetargetOnCleanup - base PR)\n(Edited - TestPullRetargetOnCleanup - child PR)" )
respBasePR := testPullCreate ( t , session , "user2" , "repo1" , true , "master" , "base-pr" , "Base Pull Request" )
@ -568,7 +568,7 @@ func TestPullRetargetChildOnBranchDelete(t *testing.T) {
func TestPullDontRetargetChildOnWrongRepo ( t * testing . T ) {
onGiteaRun ( t , func ( t * testing . T , giteaURL * url . URL ) {
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFileToNewBranch ( t , session , "user1" , "repo1" , "master" , "base-pr" , "README.md" , "Hello, World\n(Edited - TestPullDontRetargetChildOnWrongRepo - base PR)\n" )
testEditFileToNewBranch ( t , session , "user1" , "repo1" , "base-pr" , "child-pr" , "README.md" , "Hello, World\n(Edited - TestPullDontRetargetChildOnWrongRepo - base PR)\n(Edited - TestPullDontRetargetChildOnWrongRepo - child PR)" )
@ -599,7 +599,7 @@ func TestPullMergeIndexerNotifier(t *testing.T) {
onGiteaRun ( t , func ( t * testing . T , giteaURL * url . URL ) {
// create a pull request
session := loginUser ( t , "user1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , "repo1" , "" )
testEditFile ( t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited)\n" )
createPullResp := testPullCreate ( t , session , "user1" , "repo1" , false , "master" , "master" , "Indexer notifier test pull" )
@ -676,7 +676,7 @@ func TestPullAutoMergeAfterCommitStatusSucceed(t *testing.T) {
session := loginUser ( t , "user1" )
user1 := unittest . AssertExistsAndLoadBean ( t , & user_model . User { ID : 1 } )
forkedName := "repo1-1"
testRepoFork ( t , session , "user2" , "repo1" , "user1" , forkedName )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , forkedName , "" )
defer func ( ) {
testDeleteRepository ( t , session , "user1" , forkedName )
} ( )
@ -759,7 +759,7 @@ func TestPullAutoMergeAfterCommitStatusSucceedAndApproval(t *testing.T) {
session := loginUser ( t , "user1" )
user1 := unittest . AssertExistsAndLoadBean ( t , & user_model . User { ID : 1 } )
forkedName := "repo1-2"
testRepoFork ( t , session , "user2" , "repo1" , "user1" , forkedName )
testRepoFork ( t , session , "user2" , "repo1" , "user1" , forkedName , "" )
defer func ( ) {
testDeleteRepository ( t , session , "user1" , forkedName )
} ( )