Documentation
¶
Overview ¶
Package gitfetch fetches directory trees from git repositories using sparse checkout, providing a forge-agnostic alternative to REST API directory listing.
Index ¶
Constants ¶
const (
MaxFiles = 1000
)
Variables ¶
This section is empty.
Functions ¶
func FetchTree ¶
func FetchTree(ctx context.Context, cloneURL, subpath, ref, token string) (map[string][]byte, error)
FetchTree fetches all files under path in a repository at ref using git sparse checkout. It creates a temporary shallow clone with only tree objects, configures sparse checkout for the target path, then reads the materialized files from disk.
Types ¶
type TransientError ¶
type TransientError struct {
Err error
}
TransientError wraps errors caused by temporary network conditions (DNS failures, connection refused, etc.) detected from git stderr.
func (*TransientError) Error ¶
func (e *TransientError) Error() string
func (*TransientError) Unwrap ¶
func (e *TransientError) Unwrap() error
type TreeFetchFunc ¶
type TreeFetchFunc func(ctx context.Context, cloneURL, path, ref, token string) (map[string][]byte, error)
TreeFetchFunc fetches all files under path in a repository at ref. Returns map[relativePath]content. Token is optional — when empty the fetch is unauthenticated (sufficient for public repos).