aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/activities/repo_activity.go5
-rw-r--r--models/issues/comment.go5
-rw-r--r--models/issues/pull.go3
-rw-r--r--models/repo/repo.go8
4 files changed, 15 insertions, 6 deletions
diff --git a/models/activities/repo_activity.go b/models/activities/repo_activity.go
index 91f5ac12bd..ba5e4959f0 100644
--- a/models/activities/repo_activity.go
+++ b/models/activities/repo_activity.go
@@ -14,6 +14,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/git"
+ "code.gitea.io/gitea/modules/gitrepo"
"xorm.io/xorm"
)
@@ -65,7 +66,7 @@ func GetActivityStats(ctx context.Context, repo *repo_model.Repository, timeFrom
return nil, fmt.Errorf("FillUnresolvedIssues: %w", err)
}
if code {
- gitRepo, closer, err := git.RepositoryFromContextOrOpen(ctx, repo.RepoPath())
+ gitRepo, closer, err := gitrepo.RepositoryFromContextOrOpen(ctx, repo)
if err != nil {
return nil, fmt.Errorf("OpenRepository: %w", err)
}
@@ -82,7 +83,7 @@ func GetActivityStats(ctx context.Context, repo *repo_model.Repository, timeFrom
// GetActivityStatsTopAuthors returns top author stats for git commits for all branches
func GetActivityStatsTopAuthors(ctx context.Context, repo *repo_model.Repository, timeFrom time.Time, count int) ([]*ActivityAuthorData, error) {
- gitRepo, closer, err := git.RepositoryFromContextOrOpen(ctx, repo.RepoPath())
+ gitRepo, closer, err := gitrepo.RepositoryFromContextOrOpen(ctx, repo)
if err != nil {
return nil, fmt.Errorf("OpenRepository: %w", err)
}
diff --git a/models/issues/comment.go b/models/issues/comment.go
index 8a3bae5b88..c63fcab894 100644
--- a/models/issues/comment.go
+++ b/models/issues/comment.go
@@ -18,7 +18,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/container"
- "code.gitea.io/gitea/modules/git"
+ "code.gitea.io/gitea/modules/gitrepo"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/references"
@@ -762,8 +762,7 @@ func (c *Comment) LoadPushCommits(ctx context.Context) (err error) {
c.OldCommit = data.CommitIDs[0]
c.NewCommit = data.CommitIDs[1]
} else {
- repoPath := c.Issue.Repo.RepoPath()
- gitRepo, closer, err := git.RepositoryFromContextOrOpen(ctx, repoPath)
+ gitRepo, closer, err := gitrepo.RepositoryFromContextOrOpen(ctx, c.Issue.Repo)
if err != nil {
return err
}
diff --git a/models/issues/pull.go b/models/issues/pull.go
index 4ae6e38ae1..2cb1e1b971 100644
--- a/models/issues/pull.go
+++ b/models/issues/pull.go
@@ -19,6 +19,7 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/git"
+ "code.gitea.io/gitea/modules/gitrepo"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/timeutil"
@@ -865,7 +866,7 @@ func PullRequestCodeOwnersReview(ctx context.Context, pull *Issue, pr *PullReque
return err
}
- repo, err := git.OpenRepository(ctx, pr.BaseRepo.RepoPath())
+ repo, err := gitrepo.OpenRepository(ctx, pr.BaseRepo)
if err != nil {
return err
}
diff --git a/models/repo/repo.go b/models/repo/repo.go
index 4401041cdd..13493ba6e8 100644
--- a/models/repo/repo.go
+++ b/models/repo/repo.go
@@ -196,6 +196,14 @@ func init() {
db.RegisterModel(new(Repository))
}
+func (repo *Repository) GetName() string {
+ return repo.Name
+}
+
+func (repo *Repository) GetOwnerName() string {
+ return repo.OwnerName
+}
+
// SanitizedOriginalURL returns a sanitized OriginalURL
func (repo *Repository) SanitizedOriginalURL() string {
if repo.OriginalURL == "" {