mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Move newbranch to standalone package (#9627)
* Move newbranch to standalone package * move branch functions to modules to avoid dependencies cycles * fix tests * fix lint * fix lint
This commit is contained in:
		@@ -13,6 +13,7 @@ import (
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	"code.gitea.io/gitea/modules/context"
 | 
			
		||||
	"code.gitea.io/gitea/modules/git"
 | 
			
		||||
	repo_module "code.gitea.io/gitea/modules/repository"
 | 
			
		||||
	"code.gitea.io/gitea/modules/setting"
 | 
			
		||||
	api "code.gitea.io/gitea/modules/structs"
 | 
			
		||||
 | 
			
		||||
@@ -71,15 +72,18 @@ func testAPIGetContentsList(t *testing.T, u *url.URL) {
 | 
			
		||||
 | 
			
		||||
	// Make a new branch in repo1
 | 
			
		||||
	newBranch := "test_branch"
 | 
			
		||||
	repo1.CreateNewBranch(user2, repo1.DefaultBranch, newBranch)
 | 
			
		||||
	err := repo_module.CreateNewBranch(user2, repo1, repo1.DefaultBranch, newBranch)
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
	// Get the commit ID of the default branch
 | 
			
		||||
	gitRepo, _ := git.OpenRepository(repo1.RepoPath())
 | 
			
		||||
	gitRepo, err := git.OpenRepository(repo1.RepoPath())
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
	defer gitRepo.Close()
 | 
			
		||||
 | 
			
		||||
	commitID, _ := gitRepo.GetBranchCommitID(repo1.DefaultBranch)
 | 
			
		||||
	// Make a new tag in repo1
 | 
			
		||||
	newTag := "test_tag"
 | 
			
		||||
	gitRepo.CreateTag(newTag, commitID)
 | 
			
		||||
	err = gitRepo.CreateTag(newTag, commitID)
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
	/*** END SETUP ***/
 | 
			
		||||
 | 
			
		||||
	// ref is default ref
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user