gitfs

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

README

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

Modifications from original version by Russ Cox:

  • do not print to STDOUT
  • context support

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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(ctx context.Context, url string) (*Repo, error)

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

func (*Repo) Clone

func (r *Repo) Clone(ctx context.Context, 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(ctx context.Context, h Hash) (fs.FS, error)

CloneHash returns the fs.FS for the given hash.

func (*Repo) Refs added in v1.2.0

func (r *Repo) Refs(ctx context.Context, prefixes ...string) ([]ref, error)

Refs executes an ls-Refs command on the remote server to look up Refs with the given prefixes. See https://git-scm.com/docs/protocol-v2#_ls_refs.

func (*Repo) Resolve

func (r *Repo) Resolve(ctx context.Context, ref string) (Hash, error)

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

Jump to

Keyboard shortcuts

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