git

package
v0.0.0-...-e7e5104 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRepositoryAlreadyExists = errors.New("repository already exists")

Functions

This section is empty.

Types

type Commit

type Commit struct {
	Author  string
	Hash    string
	Message string
}

type CommitOpts

type CommitOpts struct {
	All bool
}

type Option

type Option func(r *repo) error

func WithDetectRootDir

func WithDetectRootDir() Option

func WithGitDir

func WithGitDir(dir string) Option

func WithRootDir

func WithRootDir(dir string) Option

type Repo

type Repo interface {
	Init(wd string, opts ...Option) error
	Open(wd string, opts ...Option) error
	InitOrOpen(wd string, opts ...Option) error

	OpenFile(filePath string, flag int, perm os.FileMode) (billy.File, error)
	CreateFile(filePath string) (billy.File, error)

	CopyFile(fromPath, toPath string) error
	Exists(filePath string) bool
	CreateDir(filePath string) (billy.Dir, error)

	RemoveFileFromIgnore(filePath string) error
	AddFileToIgnore(filePath string) error

	AddFileToGit(filePath string) error
	Commit(msg string, opts CommitOpts) error
	Log() []Commit
	Workdir() string
	Gitdir() string

	Branch() (string, error)
	Hash() (string, error)
}

func New

func New(opts ...Option) (Repo, error)

func Open

func Open(wd string, opts ...Option) (Repo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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