Documentation
¶
Index ¶
- Constants
- func IsLFSAvailable() bool
- func IsLFSHook(hookName string) bool
- type Repository
- func (r *Repository) AllFiles() ([]string, error)
- func (r *Repository) FilesByCommand(command string) ([]string, error)
- func (r *Repository) PushFiles() ([]string, error)
- func (r *Repository) RemoteFolder(url string) string
- func (r *Repository) RemotesFolder() string
- func (r *Repository) StagedFiles() ([]string, error)
- func (r *Repository) State() State
- func (r *Repository) SyncRemote(url, ref string) error
- type State
Constants ¶
const ( LFSRequiredFile = ".lfs-required" LFSConfigFile = ".lfsconfig" )
Variables ¶
This section is empty.
Functions ¶
func IsLFSAvailable ¶ added in v1.1.0
func IsLFSAvailable() bool
IsLFSAvailable returns 'true' if git-lfs is installed.
Types ¶
type Repository ¶
type Repository struct {
Fs afero.Fs
HooksPath string
RootPath string
GitPath string
InfoPath string
}
Repository represents a git repository.
func NewRepository ¶
func NewRepository(fs afero.Fs) (*Repository, error)
NewRepository returns a Repository or an error, if git repository it not initialized.
func (*Repository) AllFiles ¶
func (r *Repository) AllFiles() ([]string, error)
StagedFiles returns a list of all files in repository or an error if git command fails.
func (*Repository) FilesByCommand ¶ added in v1.0.4
func (r *Repository) FilesByCommand(command string) ([]string, error)
FilesByCommand accepts git command and returns its result as a list of filepaths.
func (*Repository) PushFiles ¶
func (r *Repository) PushFiles() ([]string, error)
PushFiles returns a list of files that are ready to be pushed or an error if git command fails.
func (*Repository) RemoteFolder ¶ added in v1.2.0
func (r *Repository) RemoteFolder(url string) string
RemoteFolder returns the path to the folder where the remote repository is located.
func (*Repository) RemotesFolder ¶ added in v1.2.0
func (r *Repository) RemotesFolder() string
RemotesFolder returns the path to the lefthook remotes folder.
func (*Repository) StagedFiles ¶
func (r *Repository) StagedFiles() ([]string, error)
StagedFiles returns a list of staged files or an error if git command fails.
func (*Repository) State ¶
func (r *Repository) State() State
func (*Repository) SyncRemote ¶ added in v1.2.0
func (r *Repository) SyncRemote(url, ref string) error
SyncRemote clones or pulls the latest changes for a git repository that was specified as a remote config repository. If successful, the path to the root of the repository will be returned.