You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

git.go 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package migrations
  4. import (
  5. "context"
  6. base "code.gitea.io/gitea/modules/migration"
  7. )
  8. var _ base.Downloader = &PlainGitDownloader{}
  9. // PlainGitDownloader implements a Downloader interface to clone git from a http/https URL
  10. type PlainGitDownloader struct {
  11. base.NullDownloader
  12. ownerName string
  13. repoName string
  14. remoteURL string
  15. }
  16. // NewPlainGitDownloader creates a git Downloader
  17. func NewPlainGitDownloader(ownerName, repoName, remoteURL string) *PlainGitDownloader {
  18. return &PlainGitDownloader{
  19. ownerName: ownerName,
  20. repoName: repoName,
  21. remoteURL: remoteURL,
  22. }
  23. }
  24. // SetContext set context
  25. func (g *PlainGitDownloader) SetContext(ctx context.Context) {
  26. }
  27. // GetRepoInfo returns a repository information
  28. func (g *PlainGitDownloader) GetRepoInfo() (*base.Repository, error) {
  29. // convert github repo to stand Repo
  30. return &base.Repository{
  31. Owner: g.ownerName,
  32. Name: g.repoName,
  33. CloneURL: g.remoteURL,
  34. }, nil
  35. }
  36. // GetTopics return empty string slice
  37. func (g PlainGitDownloader) GetTopics() ([]string, error) {
  38. return []string{}, nil
  39. }