executor

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAll

func AddAll(path string) error

Add all files to the staging area

If git is installed, use git add . to add all files. If not, use go-git

func AddIndexPath

func AddIndexPath(w git.Worktree, path string) error

Add a file to the staging area

func AddRemote

func AddRemote(path string, name string, url string) error

func CheckIfBranchExists

func CheckIfBranchExists(path string, branchName string) (bool, error)

func CheckoutBranch

func CheckoutBranch(path string, branchName string) error

func CheckoutCommit

func CheckoutCommit(path string, commitHash string) error

func Clone

func Clone(repo string, path string, oldCommitSave bool) error

func CloneWithAuth

func CloneWithAuth(repo string, path string, username string, password string, oldCommitSave bool) error

func CreateBranch

func CreateBranch(path string, branchName string) error

func DeleteBranch

func DeleteBranch(path string, branchName string) error

func EditorGetText

func EditorGetText(editor string, defaultText string, wd string, fileTitle string) (string, error)

Get an input from the user using the specified editor. Similar to the git commit command that opens the editor to write the commit message

Return the input as a string

func GetCommitByHash

func GetCommitByHash(path string, hash string) (object.Commit, error)

func GetConfigEditor

func GetConfigEditor() (string, error)

Get the set editor

func GetCurrentBranch

func GetCurrentBranch(path string) (string, error)

func GetGitURL

func GetGitURL(path string) (string, error)

func GetHeadHash

func GetHeadHash(path string) (string, error)

func GetUserConfig

func GetUserConfig(path string) (string, string, error)

func GitAddAll

func GitAddAll() error

Add all the files to the index

func GitCheckoutFileHead

func GitCheckoutFileHead(file string) error

I prefer to use checkout because git reset gave me some problems When used with a file in args, git reset was thinking it was a directory. Because of that, git reset was just exiting with an error

func GitCommitAmend

func GitCommitAmend(message string) error

Amend the last commit with the message

func GitCommitAmendNoEdit

func GitCommitAmendNoEdit() error

Amend the last commit but leave the message unchanged

func GitConfigPullRebaseTrueOnlyIfNotSet

func GitConfigPullRebaseTrueOnlyIfNotSet() error

Set git config pull.rebase true only if not set to a value

func GitDeleteRemoteBranch

func GitDeleteRemoteBranch(remote string, branch string) error

Delete a remote branch

func GitDiffIndexCommit

func GitDiffIndexCommit(commit string) (bool, error)

Diff the index with a given commit or branch and return true if there is no diff

func GitDiffIndexHead

func GitDiffIndexHead() (bool, error)

Diff the index with the HEAD and return true if there is no diff

func GitDiffRef

func GitDiffRef(ref1 string, ref2 string) (bool, error)

Diff a ref to another ref and return true if there is no diff

func GitFetchAll

func GitFetchAll() error

Fetch all the branches from the remote

func GitPull

func GitPull(username string, password string, remote string) error

Execute git pull using the exec package

func GitPullRebase

func GitPullRebase(username string, password string, remote string) error

Execute git pull --rebase using the exec package

func GitRemoteContainsHash

func GitRemoteContainsHash(hash string) bool

Check if the remote contains the hash Used to check if the commit is already pushed to the remote

func GitRemoveAll

func GitRemoveAll() error

Remove all the files from the index

func GitResetAllHead

func GitResetAllHead() error

func GitRevert

func GitRevert(commitID string) error

Execute git revert --no-edit using the exec package

func GitRmCached

func GitRmCached() error

func GitStash

func GitStash() error

Stash the changes

func GitStashPop

func GitStashPop() error

Pop the changes from the stash

func Init

func Init(path string) error

func IsDetachedHead

func IsDetachedHead(path string) (bool, error)

func IsGitInstalled

func IsGitInstalled() bool

Check if git is installed on the system

func IsPathGitRepo

func IsPathGitRepo(path string) bool

func IsWorkTreeClean

func IsWorkTreeClean(path string) (bool, error)

func ListAllCommits

func ListAllCommits(path string) ([]object.Commit, error)

List all commits for the repo even if not on the current branch

func ListBranches

func ListBranches(path string) ([]string, error)

func ListCommit

func ListCommit(path string) ([]object.Commit, error)

List commit for the current branch

func OpenRepo

func OpenRepo(path string) (*git.Repository, error)

func Pull

func Pull(path string, remote string, username string, password string) error

func Push

func Push(path string, remote string, username string, password string) error

func RemoteExists

func RemoteExists(path string, name string) (bool, error)

func RemoveAll

func RemoveAll(path string) error

Remove all files from the staging area

func RemoveRemote

func RemoveRemote(path string, name string) error

func SetUserConfig

func SetUserConfig(path string, name string, email string) error

func SoftReset

func SoftReset(path string, commit object.Commit) error

Types

type CommitResult

type CommitResult struct {
	Hash         string
	FilesAdded   int
	FilesUpdated int
	FilesDeleted int
}

func Commit

func Commit(path string, message string, file []string) (CommitResult, error)

Commit the changes If no files are passed as arguments, all files will be committed Otherwise, only the files passed as arguments will be committed

type FileStatus

type FileStatus struct {
	Path   string
	Status string
}

func GetStatus

func GetStatus(path string) ([]FileStatus, error)

type Remote

type Remote struct {
	Name string
	Url  string
}

func ListRemote

func ListRemote(path string) ([]Remote, error)

Jump to

Keyboard shortcuts

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