summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-14 11:38:04 +0800
committerGitHub <noreply@github.com>2020-01-14 11:38:04 +0800
commit2677d071f911fb91f382acfedaedc251bd807f70 (patch)
tree61d48125ff6e509e5ffe385b23fdc14fb454b9e6 /integrations
parentbca367cecc6004957a952bb6222b9bbdc868e784 (diff)
downloadgitea-2677d071f911fb91f382acfedaedc251bd807f70.tar.gz
gitea-2677d071f911fb91f382acfedaedc251bd807f70.zip
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
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_repo_get_contents_list_test.go10
-rw-r--r--integrations/api_repo_get_contents_test.go13
2 files changed, 16 insertions, 7 deletions
diff --git a/integrations/api_repo_get_contents_list_test.go b/integrations/api_repo_get_contents_list_test.go
index 4605ccf4d9..abc4f42cf4 100644
--- a/integrations/api_repo_get_contents_list_test.go
+++ b/integrations/api_repo_get_contents_list_test.go
@@ -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
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