Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Jan 3, 2025
1 parent 453adc2 commit dfe8cb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions models/fixtures/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
commit_message: 'first commit'
commit_time: 978307100
pusher_id: 1
is_deleted: false

-
id: 18
Expand All @@ -121,6 +122,7 @@
commit_message: 'Initial commit'
commit_time: 1489956479
pusher_id: 1
is_deleted: false

-
id: 19
Expand All @@ -140,6 +142,7 @@
commit_message: 'add WoW File'
commit_time: 1579200695
pusher_id: 1
is_deleted: false

-
id: 21
Expand Down
8 changes: 7 additions & 1 deletion tests/integration/pull_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/gitrepo"
"code.gitea.io/gitea/modules/queue"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/test"
Expand Down Expand Up @@ -308,7 +309,8 @@ func TestCantMergeUnrelated(t *testing.T) {
assert.NoError(t, err)
sha := strings.TrimSpace(stdout.String())

_, _, err = git.NewCommand(git.DefaultContext, "update-index", "--add", "--replace", "--cacheinfo").AddDynamicArguments("100644", sha, "somewher-over-the-rainbow").RunStdString(&git.RunOpts{Dir: path})
_, _, err = git.NewCommand(git.DefaultContext, "update-index", "--add", "--replace", "--cacheinfo").
AddDynamicArguments("100644", sha, "somewher-over-the-rainbow").RunStdString(&git.RunOpts{Dir: path})
assert.NoError(t, err)

treeSha, _, err := git.NewCommand(git.DefaultContext, "write-tree").RunStdString(&git.RunOpts{Dir: path})
Expand Down Expand Up @@ -344,6 +346,10 @@ func TestCantMergeUnrelated(t *testing.T) {
_, _, err = git.NewCommand(git.DefaultContext, "branch", "unrelated").AddDynamicArguments(commitSha).RunStdString(&git.RunOpts{Dir: path})
assert.NoError(t, err)

// we created a branch to git repository directly, now we need to do a sync to make it available in the database
_, err = repo_module.SyncRepoBranches(db.DefaultContext, repo1.ID, user1.ID)
assert.NoError(t, err)

testEditFileToNewBranch(t, session, "user1", "repo1", "master", "conflict", "README.md", "Hello, World (Edited Once)\n")

// Use API to create a conflicting pr
Expand Down

0 comments on commit dfe8cb7

Please sign in to comment.