Documentation
¶
Index ¶
- Constants
- func CanonicalTreeURL(source Source) string
- func ChoosePackagePrefix(paths map[string]struct{}, blobPath string, ...) (string, bool)
- func CollectRepoRelativePaths(archive io.Reader) (map[string]struct{}, error)
- func DownloadTarball(ctx context.Context, client *http.Client, owner, repo, sha string) ([]byte, error)
- func ExtractTarballWithPrefix(archive io.Reader, prefix, destination string) (int, error)
- func LinkStaysInside(relative, target string) bool
- func NormalizedIdentity(source Source, commit string) string
- func ParentDirInRepo(inRepoPath string) string
- func PathLooksLikeFile(inRepoPath string) bool
- func ReadRepoFiles(archive io.Reader, names ...string) (map[string][]byte, error)
- func ResolveRef(ctx context.Context, client *http.Client, owner, repo, gitRef string, ...) (string, error)
- type Source
- type Tag
Constants ¶
const ( Host = "github.com" DefaultGitRef = "HEAD" )
Variables ¶
This section is empty.
Functions ¶
func CanonicalTreeURL ¶
func ChoosePackagePrefix ¶
func DownloadTarball ¶
func DownloadTarball(ctx context.Context, client *http.Client, owner, repo, sha string) ([]byte, error)
DownloadTarball tries anonymous codeload first, authenticated codeload for private repositories second, then the Git protocol. Transient HTTP failures receive the same three-attempt exponential retry policy as other sources.
func LinkStaysInside ¶
LinkStaysInside reports whether a symbolic link at relative (inside the extracted tree) may be created as written. The target must be a clean relative path — any ".." only at its start — that still lies inside the tree, so that following it, however links are chained, cannot leave the tree. Every other link (absolute, or reaching a part of the repository that is not extracted) is written as an empty file, as before.
func NormalizedIdentity ¶
func ParentDirInRepo ¶
func PathLooksLikeFile ¶
func ReadRepoFiles ¶
ReadRepoFiles returns the contents of the named repository-relative files that the archive holds.