2019-05-06 19:12:51 -06:00
|
|
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
2022-11-27 11:20:29 -07:00
|
|
|
// SPDX-License-Identifier: MIT
|
2019-05-06 19:12:51 -06:00
|
|
|
|
|
|
|
package migrations
|
|
|
|
|
|
|
|
import (
|
2019-12-16 21:16:54 -07:00
|
|
|
"context"
|
|
|
|
|
2021-11-16 08:25:33 -07:00
|
|
|
base "code.gitea.io/gitea/modules/migration"
|
2019-05-06 19:12:51 -06:00
|
|
|
)
|
|
|
|
|
2022-01-20 10:46:10 -07:00
|
|
|
var _ base.Downloader = &PlainGitDownloader{}
|
2019-05-06 19:12:51 -06:00
|
|
|
|
|
|
|
// PlainGitDownloader implements a Downloader interface to clone git from a http/https URL
|
|
|
|
type PlainGitDownloader struct {
|
2021-01-21 12:33:58 -07:00
|
|
|
base.NullDownloader
|
2019-05-06 19:12:51 -06:00
|
|
|
ownerName string
|
|
|
|
repoName string
|
|
|
|
remoteURL string
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewPlainGitDownloader creates a git Downloader
|
|
|
|
func NewPlainGitDownloader(ownerName, repoName, remoteURL string) *PlainGitDownloader {
|
|
|
|
return &PlainGitDownloader{
|
|
|
|
ownerName: ownerName,
|
|
|
|
repoName: repoName,
|
|
|
|
remoteURL: remoteURL,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-16 21:16:54 -07:00
|
|
|
// SetContext set context
|
|
|
|
func (g *PlainGitDownloader) SetContext(ctx context.Context) {
|
|
|
|
}
|
|
|
|
|
2019-05-06 19:12:51 -06:00
|
|
|
// GetRepoInfo returns a repository information
|
|
|
|
func (g *PlainGitDownloader) GetRepoInfo() (*base.Repository, error) {
|
|
|
|
// convert github repo to stand Repo
|
|
|
|
return &base.Repository{
|
|
|
|
Owner: g.ownerName,
|
|
|
|
Name: g.repoName,
|
|
|
|
CloneURL: g.remoteURL,
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
|
2021-01-21 12:33:58 -07:00
|
|
|
// GetTopics return empty string slice
|
|
|
|
func (g PlainGitDownloader) GetTopics() ([]string, error) {
|
2019-08-14 00:16:12 -06:00
|
|
|
return []string{}, nil
|
|
|
|
}
|