From 2677d071f911fb91f382acfedaedc251bd807f70 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 14 Jan 2020 11:38:04 +0800 Subject: 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 --- integrations/api_repo_get_contents_test.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'integrations/api_repo_get_contents_test.go') diff --git a/integrations/api_repo_get_contents_test.go b/integrations/api_repo_get_contents_test.go index 77a827ec61..184e76831b 100644 --- a/integrations/api_repo_get_contents_test.go +++ b/integrations/api_repo_get_contents_test.go @@ -12,6 +12,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" @@ -72,15 +73,19 @@ func testAPIGetContents(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) + commitID, err := gitRepo.GetBranchCommitID(repo1.DefaultBranch) + assert.NoError(t, err) // 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 -- cgit v1.2.3