ghvfs

package module
v0.0.0-...-0f99bd0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

README

ghvfs

Virtual filesystem for GitHub content

Usage

First, mount the filesystem somewhere:

govfs /tmp/gh

Paths in the virtual filesystem are in the form /[org]/[repo]/[ref]/[path].

For example, to see files as they were at the time of the first commit to ghvfs:

$ ls /tmp/gh/vgough/ghvfs/cc289b54162f8e9521042e0efb79c779fc89cad9/
cmd  files.go  fs.go  Gopkg.lock  Gopkg.toml  LICENSE  logs.go  README.md  vendor

GitHub Enterprise

To use with an enterprise installation, pass a GitHub URL and token. These can be passed using command line flags and/or environment variables. For example:

GITHUB_TOKEN=xxx ghvfs --github=https://github.internal.example.com/ /tmp/gh

Performance

ghvfs is intended to be used when sparse access is needed to a github repository. For example, when running a tool which might pull in other references. Instead of cloning the entire repo locally, this allows files to be pulled on-demand.

If you intend to a large fraction of the files in the repository, it is almost certainly faster to clone the repo (with limited depth) and use the local copy.

ghvfs by default keeps an LRU cache of the last few thousand file entries and directory listings, to avoid repeating GitHub queries. This can be controlled by the --cache flag.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Debug is the debug output channel.
	// It is reconfigured to use os.Stderr if debug is enabled.
	Debug = log.New(ioutil.Discard, "DEBUG ", log.LstdFlags)
	// Info is a standard information output channel.
	Info = log.New(os.Stderr, "INFO ", log.LstdFlags)
	// Error is an error output channel.
	Error = log.New(os.Stderr, "ERROR ", log.LstdFlags)
)

Functions

func NewFS

func NewFS(opts ...Opt) pathfs.FileSystem

NewFS creates a new filesystem.

Types

type Opt

type Opt func(*config)

Opt is an option for filesystem construction.

func WithCacheSize

func WithCacheSize(size int) Opt

WithCacheSize provides a cache size for internal attribute caching.

func WithGHEndpoint

func WithGHEndpoint(base string) Opt

WithGHEndpoint allows specifying an optional GitHub base URL. This can be used to point to an internal GitHub Enterprise endpoint.

func WithToken

func WithToken(t string) Opt

WithToken provides a GitHub token for authentication. The token must provide read access to contents for the orgs and repos being accessed.

Directories

Path Synopsis
cmd
ghvfs command

Jump to

Keyboard shortcuts

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