package gitfs

import "golang.org/x/build/internal/gitfs"

Package gitfs presents a file tree downloaded from a remote Git repo as an in-memory fs.FS.

Index

Types

type Hash

type Hash [20]byte

A Hash is a SHA-1 Hash identifying a particular Git object.

func (Hash) String

func (h Hash) String() string

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

A Repo is a connection to a remote repository served over HTTP or HTTPS.

func NewRepo

func NewRepo(url string) (*Repo, error)

NewRepo connects to a Git repository at the given http:// or https:// URL.

func (*Repo) Clone

func (r *Repo) Clone(ref string) (Hash, fs.FS, error)

Clone resolves the given ref to a hash and returns the corresponding fs.FS.

func (*Repo) CloneHash

func (r *Repo) CloneHash(h Hash) (fs.FS, error)

CloneHash returns the fs.FS for the given hash.

func (*Repo) Resolve

func (r *Repo) Resolve(ref string) (Hash, error)

Resolve looks up the given ref and returns the corresponding Hash.

Source Files

doc.go gitfs.go

Version
v0.0.0-20250421191922-3619c213cff3 (latest)
Published
Apr 21, 2025
Platform
linux/amd64
Imports
15 packages
Last checked
3 months ago

Tools for package owners.