git

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyPath         = errors.New("path is empty string")
	ErrPathNotAFile      = errors.New("the path is not a file")
	ErrReachedRoot       = errors.New("we reached the root without finding a .git file or folder")
	ErrParseRepoPath     = errors.New("failed to parse repository path")
	ErrParseBareRepoPath = errors.New("failed to parse bare repository path")
)

Functions

func ParseFile

func ParseFile(absolutePath, filetype string) (pulse.GitFile, error)

Types

type FileParser

type FileParser struct {
	Reader Reader
}

func New

func New() FileParser

New creates a new FileParser.

func (FileParser) ParseFile

func (f FileParser) ParseFile(absolutePath, filetype string) (pulse.GitFile, error)

ParseFile returns a ParseFile struct from an absolute path. It will return an error if the path is empty, if the path is not a file or if it can't find a parent .git file or folder before it reaches the root of the file tree.

type Reader

type Reader interface {
	Dir(string) string
	ReadDir(string) ([]fs.DirEntry, error)
	ReadFile(string) ([]byte, error)
	IsFile(string) bool
}

Reader is an abstraction for the reader.

Jump to

Keyboard shortcuts

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