summaryrefslogtreecommitdiffstats
path: root/models/repo_generate.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-01-12 17:36:21 +0800
committerGitHub <noreply@github.com>2020-01-12 17:36:21 +0800
commit5765212c6dbcaeb27779707af3ca57775e535bd9 (patch)
treed3cf5fcedf21486e3b26731ba93cebd8ee13532b /models/repo_generate.go
parent65baacf2273f74876b3faed93f60641389a20d39 (diff)
downloadgitea-5765212c6dbcaeb27779707af3ca57775e535bd9.tar.gz
gitea-5765212c6dbcaeb27779707af3ca57775e535bd9.zip
Add owner_name column for table repository for maintaince reason (#9717)
* Add owner_name column for table repository for maintaince reason * refactor * Fix tests * fix test * fix bug when fork repository Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'models/repo_generate.go')
-rw-r--r--models/repo_generate.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/models/repo_generate.go b/models/repo_generate.go
index 1b0466eaa7..6761c1ce41 100644
--- a/models/repo_generate.go
+++ b/models/repo_generate.go
@@ -107,7 +107,7 @@ func generateRepoCommit(e Engine, repo, templateRepo, generateRepo *Repository,
)
// Clone to temporary path and do the init commit.
- templateRepoPath := templateRepo.repoPath(e)
+ templateRepoPath := templateRepo.RepoPath()
if err := git.Clone(templateRepoPath, tmpDir, git.CloneRepoOptions{
Depth: 1,
}); err != nil {
@@ -168,7 +168,7 @@ func generateRepoCommit(e Engine, repo, templateRepo, generateRepo *Repository,
return err
}
- repoPath := repo.repoPath(e)
+ repoPath := repo.RepoPath()
if stdout, err := git.NewCommand("remote", "add", "origin", repoPath).
SetDescription(fmt.Sprintf("generateRepoCommit (git remote add): %s to %s", templateRepoPath, tmpDir)).
RunInDirWithEnv(tmpDir, env); err != nil {
@@ -183,7 +183,7 @@ func generateRepoCommit(e Engine, repo, templateRepo, generateRepo *Repository,
func generateRepository(e Engine, repo, templateRepo, generateRepo *Repository) (err error) {
tmpDir, err := ioutil.TempDir(os.TempDir(), "gitea-"+repo.Name)
if err != nil {
- return fmt.Errorf("Failed to create temp dir for repository %s: %v", repo.repoPath(e), err)
+ return fmt.Errorf("Failed to create temp dir for repository %s: %v", repo.RepoPath(), err)
}
defer func() {
@@ -263,13 +263,13 @@ func GenerateTopics(ctx DBContext, templateRepo, generateRepo *Repository) error
// GenerateGitHooks generates git hooks from a template repository
func GenerateGitHooks(ctx DBContext, templateRepo, generateRepo *Repository) error {
- generateGitRepo, err := git.OpenRepository(generateRepo.repoPath(ctx.e))
+ generateGitRepo, err := git.OpenRepository(generateRepo.RepoPath())
if err != nil {
return err
}
defer generateGitRepo.Close()
- templateGitRepo, err := git.OpenRepository(templateRepo.repoPath(ctx.e))
+ templateGitRepo, err := git.OpenRepository(templateRepo.RepoPath())
if err != nil {
return err
}
@@ -365,9 +365,9 @@ func generateExpansion(src string, templateRepo, generateRepo *Repository) strin
case "TEMPLATE_DESCRIPTION":
return templateRepo.Description
case "REPO_OWNER":
- return generateRepo.MustOwnerName()
+ return generateRepo.OwnerName
case "TEMPLATE_OWNER":
- return templateRepo.MustOwnerName()
+ return templateRepo.OwnerName
case "REPO_LINK":
return generateRepo.Link()
case "TEMPLATE_LINK":