diff options
author | Toon Claes <toon@gitlab.com> | 2022-05-20 17:07:57 +0300 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2022-07-08 11:24:17 +0300 |
commit | d634f0a35af604959797e5a138261a6f95e88521 (patch) | |
tree | f478df21a49f25ac813dc64fd420e8e4dc3e8f05 /internal/gitaly/linguist/linguist.go | |
parent | d6dfd746290dc442dd9deca0cc0fe69470e9ca18 (diff) |
linguist: Change prototype of Stats method
We're about to add an alternative implementation for the Stats method,
written in Go, and for that we need a few different things. This change
prepares for that.
Diffstat (limited to 'internal/gitaly/linguist/linguist.go')
-rw-r--r-- | internal/gitaly/linguist/linguist.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/gitaly/linguist/linguist.go b/internal/gitaly/linguist/linguist.go index da085b58a..5e09431e3 100644 --- a/internal/gitaly/linguist/linguist.go +++ b/internal/gitaly/linguist/linguist.go @@ -12,6 +12,8 @@ import ( "gitlab.com/gitlab-org/gitaly/v15/internal/command" "gitlab.com/gitlab-org/gitaly/v15/internal/git" + "gitlab.com/gitlab-org/gitaly/v15/internal/git/catfile" + "gitlab.com/gitlab-org/gitaly/v15/internal/git/localrepo" "gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/v15/internal/helper/env" ) @@ -53,7 +55,12 @@ func New(cfg config.Cfg, gitCmdFactory git.CommandFactory) (*Instance, error) { } // Stats returns the repository's language stats as reported by 'git-linguist'. -func (inst *Instance) Stats(ctx context.Context, repoPath string, commitID string) (ByteCountPerLanguage, error) { +func (inst *Instance) Stats(ctx context.Context, repo *localrepo.Repo, commitID string, catfileCache catfile.Cache) (ByteCountPerLanguage, error) { + repoPath, err := repo.Path() + if err != nil { + return nil, fmt.Errorf("get repo path: %w", err) + } + cmd, err := inst.startGitLinguist(ctx, repoPath, commitID) if err != nil { return nil, fmt.Errorf("starting linguist: %w", err) |