48 lines · 1.1 KB · Go
RawDownload
// Copyright 2019 The Gitea Authors. All rights reserved.// SPDX-License-Identifier: MIT package migrations import (	"context" 	base "forgejo.org/modules/migration") var _ base.Downloader = &PlainGitDownloader{} // PlainGitDownloader implements a Downloader interface to clone git from a http/https URLtype PlainGitDownloader struct {	base.NullDownloader	ownerName string	repoName  string	remoteURL string} // NewPlainGitDownloader creates a git Downloaderfunc NewPlainGitDownloader(ownerName, repoName, remoteURL string) *PlainGitDownloader {	return &PlainGitDownloader{		ownerName: ownerName,		repoName:  repoName,		remoteURL: remoteURL,	}} // SetContext set contextfunc (g *PlainGitDownloader) SetContext(ctx context.Context) {} // GetRepoInfo returns a repository informationfunc (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} // GetTopics return empty string slicefunc (g PlainGitDownloader) GetTopics() ([]string, error) {	return []string{}, nil}