repository

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAValidGitRepo = func(path string) error {
		return fmt.Errorf("%s is not a valid git repository", path)
	}
	ErrGitRemoteURLNotFound = errors.New("repository doesn't have remote URLs")
)

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	DirPath     string
	Protocol    string
	Provider    string
	UserAccount string
	RemoteURL   string
	RepoName    string
	Branch      string
	CommitHash  string
}

Metadata contains repository metadata.

type Repository

type Repository interface {
	// GetMetadataFromRemoteURL extracts information from git repository remote URL and parse it to repository.Repository.
	// It only accepts 2 formats for now: "git@github.com:user/git-repo-name.git" and "https://github.com/user/git-repo-name.git".
	GetMetadataFromRemoteURL() (*Metadata, error)
	// ListFiles walking through git worktree and list of all files in repository whether is tracked or untracked.
	// This function respect rules defined in every .gitignore and also will exclude all files with type in ignoreList.
	ListFiles() ([]string, error)
}

Repository defines methods to interact with git repository.

func New

func New(projectPath string) (Repository, error)

New instantiates new repository.

Directories

Path Synopsis
Package mockrepository is a generated GoMock package.
Package mockrepository is a generated GoMock package.

Jump to

Keyboard shortcuts

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