git

package module
v0.0.0-...-1bd01fd Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: GPL-3.0 Imports: 9 Imported by: 2

README

GO GIT

Go-git is a simple GO module which wrap GIT cli in GO.

Contribution

Feel free to use it and contribute if few features are missing for you. Follow the usual Pull Request mechanism of Github to submit code or issues to discuss.

Forj Team

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(files []string) int

Add call git add

func BranchExist

func BranchExist(remote string) (bool, error)

BranchExist return true if the branch exist

func Branches

func Branches() ([]string, error)

Branches retrieved the list of branch from git branch

func Commit

func Commit(msg string, errorIfEmpty bool) (err error)

Commit Do a git commit

func Do

func Do(opts ...string) int

Do Call git command with arguments. All print out displayed. It returns git Return code.

func EnsureRemoteIs

func EnsureRemoteIs(name, url string) error

EnsureRemoteIs will update the remote name with the url...

func EnsureRepoExist

func EnsureRepoExist(aPath string) error

EnsureRepoExist ensure a local repo exist.

func Get

func Get(opts ...string) (string, error)

Get Call a git command and get the output as string output.

func GetCurrentBranch

func GetCurrentBranch() (branch string)

GetCurrentBranch return the current branch name. If no branch is detected, it returns "master"

func GetWithStatusCode

func GetWithStatusCode(opts ...string) (string, int)

GetWithStatusCode Call a git command and get the output as string output.

func Indent

func Indent(begin, indent, end string)

Indent permit to display several command indented within a section tag.

func Push

func Push() error

Push Push latest commits

func RemoteBranchExist

func RemoteBranchExist(remote string) (bool, error)

RemoteBranchExist check is remote branch if known by GIT.

Remote: Formated as <remote>/<branchName>

func RemoteBranches

func RemoteBranches() ([]string, error)

RemoteBranches returns the list of Remote branches found Formatted as <remote>/<branchName>

func RemoteExist

func RemoteExist(remote string) (found bool)

RemoteExist return true if remote is defined.

func RemoteStatus

func RemoteStatus(remote string) (_ string, err error)

RemoteStatus provide a sync status information

func RemoteURL

func RemoteURL(remote string) (string, bool, error)

RemoteURL returns the url of the remote requested.

func RunInPath

func RunInPath(gitRepoPath string, runIn func() error) error

RunInPath run a function in a specificDirectory and restore the current Path.

func SetLogFunc

func SetLogFunc(aLogFunc func(string))

Define the internal Log system. By default it uses log.Print

func ShowGitPath

func ShowGitPath() (msg string)

ShowGitPath display the current GI path

func UnIndent

func UnIndent()

UnIndent revert Indent.

Types

type Status

type Status struct {
	Ready    gitFiles
	NotReady gitFiles
	Err      error
}

Status contains a representation of GIT status in porcelain mode.

func GetStatus

func GetStatus() (gs *Status)

GetStatus return an GitStatus struct with the list of files, added, updated and

func (*Status) CountFiles

func (gs *Status) CountFiles() int

CountFiles returns the number of files updated tracked or not.

func (*Status) CountTracked

func (gs *Status) CountTracked() int

CountTracked returns the number of tracked files updated in ready or not ready area.

func (*Status) CountUntracked

func (gs *Status) CountUntracked() int

CountUntracked returns the number of tracked files updated in ready or not ready area.

func (*Status) Files

func (gs *Status) Files() (files []string)

Files return all files updated identified by git status

func (*Status) Tracked

func (gs *Status) Tracked() (files []string)

Tracked return Tracked files

func (*Status) Untracked

func (gs *Status) Untracked() (files []string)

Untracked return Tracked files

Jump to

Keyboard shortcuts

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