git

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Username string = "username"
	Email    string = "username@domain.com"
)

Variables

View Source
var (
	ErrStrOpeningRepo                   = "opening repository"
	ErrStrRetrievingGlobalConfiguration = "retrieving global git configuration"
	ErrStrRetrievingWorkTree            = "retrieving git worktree"
	ErrStrCommittingChanges             = "committing changes"
	ErrStrTaggingChanges                = "tagging changes"
	ErrStrLoadingConfiguration          = "loading git configuration from global scope"

	ErrStrFormattedStagingAFile = "staging a file %s"
)

Functions

func GetRepoFromFileSystem

func GetRepoFromFileSystem(meta billy.Filesystem, data billy.Filesystem) (*git.Repository, error)

func Init

func Init(meta billy.Filesystem, data billy.Filesystem) error

Types

type ConfigParser

type ConfigParser struct {
	Config *config.Config
}

func (*ConfigParser) GetSectionOption

func (cp *ConfigParser) GetSectionOption(section string, option string) string

func (*ConfigParser) LoadConfig

func (cp *ConfigParser) LoadConfig(scope config.Scope) (*config.Config, error)

func (*ConfigParser) SetConfig

func (cp *ConfigParser) SetConfig(config *config.Config)

type ConfigParserInterface

type ConfigParserInterface interface {
	GetSectionOption(string, string) string
	SetConfig(*config.Config)
	LoadConfig(config.Scope) (*config.Config, error)
}

type Instance

type Instance struct {
	Repository RepositoryInterface
	Worktree   WorktreeInterface
	Config     *config.Config
}

func GetInstanceFromRepo

func GetInstanceFromRepo(repo RepositoryInterface) (*Instance, error)

func New

func New(meta billy.Filesystem, data billy.Filesystem) (*Instance, error)

func (*Instance) Commit

func (i *Instance) Commit(files []string, version string, sign *object.Signature, entity *openpgp.Entity) (plumbing.Hash, error)

func (*Instance) GetSigningKeyFromConfig

func (i *Instance) GetSigningKeyFromConfig(configParser ConfigParserInterface) (string, error)

func (*Instance) Save

func (i *Instance) Save(files []string, version string, gpgEntity *openpgp.Entity) error

type RepositoryInterface

type RepositoryInterface interface {
	Worktree() (*git.Worktree, error)
	CreateTag(string, plumbing.Hash, *git.CreateTagOptions) (*plumbing.Reference, error)
	ConfigScoped(config.Scope) (*config.Config, error)
}

type WorktreeInterface

type WorktreeInterface interface {
	Add(string) (plumbing.Hash, error)
	Commit(string, *git.CommitOptions) (plumbing.Hash, error)
}

Jump to

Keyboard shortcuts

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