gitfetch

package
v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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

View Source
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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL