fs

package
v0.0.0-...-5c2efdf Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRepoURLUnknownProtocol = errors.New("could not match repo url to a valid protocol")
)

Functions

This section is empty.

Types

type Directory

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

Directory represents a path on the local filesystem where cloned repositories can be stored.

func NewDirectory

func NewDirectory(logger *slog.Logger, options config.Options) Directory

NewDirectory returns a new Directory object for the provided path.

func (Directory) AllRepoPaths

func (d Directory) AllRepoPaths(prefixPath string) ([]string, error)

AllRepoPaths returns the paths of all repos matching the given prefix path. If the repository is bare, the top-level root directory is chosen (the one containing .bare).

func (Directory) AllRepos

func (d Directory) AllRepos(prefixPath string) ([]*git.Repository, error)

AllRepos returns a git.Repository to all repositories matching the given prefix path. If the repository is bare, the worktree of the default branch is chosen.

func (Directory) RepoPath

func (d Directory) RepoPath(repoURL string) (string, error)

RepoPath returns the absolute path on the local filesystem that corresponds to the provided git repository URL. The generated path is unique to the specific repository and includes the domain, path (usually org/user), and repo name (last path element).

Jump to

Keyboard shortcuts

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