Documentation
¶
Overview ¶
Package gitutil provides helpers for running git commands and parsing output.
Index ¶
- func CommitsAhead(branch, remote string) (int, error)
- func CurrentBranch() (string, error)
- func HeadParents() ([]string, error)
- func HeadSHA() (string, error)
- func HeadSHAShort() (string, error)
- func IsGitRepo() bool
- func IsShallowRepo() bool
- func ParseProjectSlugFromURL(remoteURL string) (projectKey, repoSlug string)
- func Refspecs(branch string) []string
- func RemoteURL(remote string) (string, error)
- func Run(args ...string) (string, error)
- func StagedFiles() ([]string, error)
- type DiffStat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommitsAhead ¶
CommitsAhead returns the number of commits ahead of upstream for the given branch.
func CurrentBranch ¶
CurrentBranch returns the current branch name.
func HeadParents ¶
HeadParents returns abbreviated SHAs of HEAD's parent commits.
func HeadSHAShort ¶
HeadSHAShort returns a 12-char abbreviated HEAD SHA.
func IsGitRepo ¶
func IsGitRepo() bool
IsGitRepo returns true if the current directory is inside a git repo.
func ParseProjectSlugFromURL ¶
ParseProjectSlugFromURL extracts Bitbucket DC project key and repo slug. Input: https://bb.example.com/scm/PLAT/api.git Returns: ("PLAT", "api")
func StagedFiles ¶
StagedFiles returns the list of files in the index (staged for commit).
Types ¶
Click to show internal directories.
Click to hide internal directories.