mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor Branch struct in package modules/git (#33980)
The `Branch` struct in `modules/git` package is unnecessary. We can just use a `string` to represent a branch
This commit is contained in:
@@ -303,7 +303,7 @@ func TestAPICreateBranchWithSyncBranches(t *testing.T) {
|
||||
RepoID: 1,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, branches, 4)
|
||||
assert.Len(t, branches, 6)
|
||||
|
||||
// make a broke repository with no branch on database
|
||||
_, err = db.DeleteByBean(db.DefaultContext, git_model.Branch{RepoID: 1})
|
||||
@@ -320,7 +320,7 @@ func TestAPICreateBranchWithSyncBranches(t *testing.T) {
|
||||
RepoID: 1,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, branches, 5)
|
||||
assert.Len(t, branches, 7)
|
||||
|
||||
branches, err = db.Find[git_model.Branch](db.DefaultContext, git_model.FindBranchOptions{
|
||||
RepoID: 1,
|
||||
|
@@ -4,6 +4,7 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -490,7 +491,7 @@ func TestChangeRepoFilesErrors(t *testing.T) {
|
||||
filesResponse, err := files_service.ChangeRepoFiles(git.DefaultContext, repo, doer, opts)
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, filesResponse)
|
||||
expectedError := "branch does not exist [name: " + opts.OldBranch + "]"
|
||||
expectedError := fmt.Sprintf("branch does not exist [repo_id: %d name: %s]", repo.ID, opts.OldBranch)
|
||||
assert.EqualError(t, err, expectedError)
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user