git

package
v6.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2018 License: MIT Imports: 13 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToPerennialBranches

func AddToPerennialBranches(branchName string)

AddToPerennialBranches adds the given branch as a perennial branch

func ClearCurrentBranchCache

func ClearCurrentBranchCache()

ClearCurrentBranchCache clears the cache of the current branch. This should be called when a rebase fails

func CommentOutSquashCommitMessage

func CommentOutSquashCommitMessage(prefix string)

CommentOutSquashCommitMessage comments out the message for the current squash merge Adds the given prefix with the newline if provided

func DeleteParentBranch

func DeleteParentBranch(branchName string)

DeleteParentBranch removes the parent branch entry for the given branch from the Git configuration.

func DoesBranchHaveUnmergedCommits

func DoesBranchHaveUnmergedCommits(branchName string) bool

DoesBranchHaveUnmergedCommits returns whether the branch with the given name contains commits that are not merged into the main branch

func EnsureBranchInSync

func EnsureBranchInSync(branchName, errorMessageSuffix string)

EnsureBranchInSync enforces that a branch with the given name is in sync with its tracking branch

func EnsureDoesNotHaveBranch

func EnsureDoesNotHaveBranch(branchName string)

EnsureDoesNotHaveBranch enforces that a branch with the given name does not exist

func EnsureDoesNotHaveConflicts

func EnsureDoesNotHaveConflicts()

EnsureDoesNotHaveConflicts asserts that the workspace has no unresolved merge conflicts.

func EnsureDoesNotHaveOpenChanges

func EnsureDoesNotHaveOpenChanges(message string)

EnsureDoesNotHaveOpenChanges assets that the workspace has no open changes

func EnsureHasBranch

func EnsureHasBranch(branchName string)

EnsureHasBranch enforces that a branch with the given name exists

func EnsureIsFeatureBranch

func EnsureIsFeatureBranch(branchName, errorSuffix string)

EnsureIsFeatureBranch asserts that the given branch is a feature branch.

func EnsureIsNotMainBranch

func EnsureIsNotMainBranch(branchName, errorMessage string)

EnsureIsNotMainBranch enforces that a branch with the given name is not the main branch

func EnsureIsNotPerennialBranch

func EnsureIsNotPerennialBranch(branchName, errorMessage string)

EnsureIsNotPerennialBranch enforces that a branch with the given name is not a perennial branch

func EnsureIsPerennialBranch

func EnsureIsPerennialBranch(branchName, errorMessage string)

EnsureIsPerennialBranch enforces that a branch with the given name is a perennial branch

func EnsureVersionRequirementSatisfied

func EnsureVersionRequirementSatisfied()

EnsureVersionRequirementSatisfied asserts that Git is the needed version or higher

func GetAncestorBranches

func GetAncestorBranches(branchName string) (result []string)

GetAncestorBranches returns the names of all parent branches for the given branch, This information is read from the cache in the Git config, so might be out of date when the branch hierarchy has been modified.

func GetBranchSha

func GetBranchSha(branchName string) string

GetBranchSha returns the SHA1 of the latest commit on the branch with the given name.

func GetChildBranches

func GetChildBranches(branchName string) (result []string)

GetChildBranches returns the names of all branches for which the given branch is a parent.

func GetConfigurationValue

func GetConfigurationValue(key string) (result string)

GetConfigurationValue returns the given configuration value, from either global or local Git configuration

func GetCurrentBranchName

func GetCurrentBranchName() string

GetCurrentBranchName returns the name of the currently checked out branch

func GetCurrentSha

func GetCurrentSha() string

GetCurrentSha returns the SHA of the currently checked out commit.

func GetExpectedPreviouslyCheckedOutBranch

func GetExpectedPreviouslyCheckedOutBranch(initialPreviouslyCheckedOutBranch, initialBranch string) string

GetExpectedPreviouslyCheckedOutBranch returns what is the expected previously checked out branch given the inputs

func GetGlobalConfigurationValue

func GetGlobalConfigurationValue(key string) string

GetGlobalConfigurationValue returns the global git configuration value for the given key

func GetGlobalNewBranchPushFlag

func GetGlobalNewBranchPushFlag() string

GetGlobalNewBranchPushFlag returns the global configuration for to push freshly created branches up to the origin remote.

func GetLastCommitMessage

func GetLastCommitMessage() string

GetLastCommitMessage returns the commit message for the last commit

func GetLocalAuthor

func GetLocalAuthor() string

GetLocalAuthor returns the locally Git configured user

func GetLocalBranches

func GetLocalBranches() (result []string)

GetLocalBranches returns the names of all branches in the local repository, ordered alphabetically

func GetLocalBranchesWithDeletedTrackingBranches

func GetLocalBranchesWithDeletedTrackingBranches() (result []string)

GetLocalBranchesWithDeletedTrackingBranches returns the names of all branches whose remote tracking branches have been deleted

func GetLocalBranchesWithMainBranchFirst

func GetLocalBranchesWithMainBranchFirst() (result []string)

GetLocalBranchesWithMainBranchFirst returns the names of all branches that exist in the local repository, ordered to have the name of the main branch first, then the names of the branches, ordered alphabetically

func GetLocalBranchesWithoutMain

func GetLocalBranchesWithoutMain() (result []string)

GetLocalBranchesWithoutMain returns the names of all branches in the local repository, ordered alphabetically without the main branch

func GetMainBranch

func GetMainBranch() string

GetMainBranch returns the name of the main branch.

func GetParentBranch

func GetParentBranch(branchName string) string

GetParentBranch returns the name of the parent branch of the given branch.

func GetParentBranchMap

func GetParentBranchMap() map[string]string

GetParentBranchMap returns a map from branch name to its parent branch

func GetPerennialBranches

func GetPerennialBranches() []string

GetPerennialBranches returns all branches that are marked as perennial.

func GetPreviouslyCheckedOutBranch

func GetPreviouslyCheckedOutBranch() string

GetPreviouslyCheckedOutBranch returns the name of the previously checked out branch

func GetPrintableBranchTree

func GetPrintableBranchTree(branchName string) (result string)

GetPrintableBranchTree returns a user printable branch tree

func GetPrintableMainBranch

func GetPrintableMainBranch() string

GetPrintableMainBranch returns a user printable main branch

func GetPrintableNewBranchPushFlag

func GetPrintableNewBranchPushFlag() string

GetPrintableNewBranchPushFlag returns a user printable new branch push flag

func GetPrintableOfflineFlag

func GetPrintableOfflineFlag() string

GetPrintableOfflineFlag returns a user printable offline flag

func GetPrintablePerennialBranches

func GetPrintablePerennialBranches() string

GetPrintablePerennialBranches returns a user printable list of perennial branches

func GetPullBranchStrategy

func GetPullBranchStrategy() string

GetPullBranchStrategy returns the currently configured pull branch strategy.

func GetRemoteOriginURL

func GetRemoteOriginURL() string

GetRemoteOriginURL returns the URL for the "origin" remote. In tests this value can be stubbed.

func GetRemoteUpstreamURL

func GetRemoteUpstreamURL() string

GetRemoteUpstreamURL returns the URL of the "upstream" remote.

func GetRootDirectory

func GetRootDirectory() string

GetRootDirectory returns the path of the rood directory of the current repository, i.e. the directory that contains the ".git" folder.

func GetTrackingBranchName

func GetTrackingBranchName(branchName string) string

GetTrackingBranchName returns the name of the remote branch that corresponds to the local branch with the given name

func GetURLHostname

func GetURLHostname(url string) string

GetURLHostname returns the hostname contained within the given Git URL.

func GetURLRepositoryName

func GetURLRepositoryName(url string) string

GetURLRepositoryName returns the repository name contains within the given Git URL.

func HasBranch

func HasBranch(branchName string) bool

HasBranch returns whether the repository contains a branch with the given name. The branch does not have to be present on the local repository.

func HasConflicts

func HasConflicts() bool

HasConflicts returns whether the local repository currently has unresolved merge conflicts.

func HasGlobalConfigurationValue

func HasGlobalConfigurationValue(key string) bool

HasGlobalConfigurationValue returns whether there is a global git configuration for the given key

func HasLocalBranch

func HasLocalBranch(branchName string) bool

HasLocalBranch returns whether the local repository contains a branch with the given name.

func HasOpenChanges

func HasOpenChanges() bool

HasOpenChanges returns whether the local repository contains uncommitted changes.

func HasParentBranch

func HasParentBranch(branchName string) bool

HasParentBranch returns whether or not the given branch has a parent

func HasRemote

func HasRemote(name string) bool

HasRemote returns whether the current repository contains a Git remote with the given name.

func HasShippableChanges

func HasShippableChanges(branchName string) bool

HasShippableChanges returns whether the supplied branch has an changes not currently on the main branchName

func HasTrackingBranch

func HasTrackingBranch(branchName string) bool

HasTrackingBranch returns whether the local branch with the given name has a tracking branch.

func IsAncestorBranch

func IsAncestorBranch(branchName, ancestorBranchName string) bool

IsAncestorBranch returns whether the given branch is an ancestor of the other given branch.

func IsBranchInSync

func IsBranchInSync(branchName string) bool

IsBranchInSync returns whether the branch with the given name is in sync with its tracking branch

func IsFeatureBranch

func IsFeatureBranch(branchName string) bool

IsFeatureBranch returns whether the branch with the given name is a feature branch.

func IsMainBranch

func IsMainBranch(branchName string) bool

IsMainBranch returns whether the branch with the given name is the main branch of the repository.

func IsMergeInProgress

func IsMergeInProgress() bool

IsMergeInProgress returns whether the local repository is in the middle of an unfinished merge process.

func IsOffline

func IsOffline() bool

IsOffline returns whether Git Town is currently in offline mode

func IsPerennialBranch

func IsPerennialBranch(branchName string) bool

IsPerennialBranch returns whether the branch with the given name is a perennial branch.

func IsRebaseInProgress

func IsRebaseInProgress() bool

IsRebaseInProgress returns whether the local repository is in the middle of an unfinished rebase process.

func IsRepository

func IsRepository() bool

IsRepository returns whether or not the current directory is in a repository

func RemoveAllConfiguration

func RemoveAllConfiguration()

RemoveAllConfiguration removes all Git Town configuration

func RemoveFromPerennialBranches

func RemoveFromPerennialBranches(branchName string)

RemoveFromPerennialBranches removes the given branch as a perennial branch

func SetMainBranch

func SetMainBranch(branchName string)

SetMainBranch marks the given branch as the main branch in the Git Town configuration.

func SetParentBranch

func SetParentBranch(branchName, parentBranchName string)

SetParentBranch marks the given branch as the direct parent of the other given branch in the Git Town configuration.

func SetPerennialBranches

func SetPerennialBranches(branchNames []string)

SetPerennialBranches marks the given branches as perennial branches

func SetPullBranchStrategy

func SetPullBranchStrategy(strategy string)

SetPullBranchStrategy updates the configured pull branch strategy.

func ShouldBranchBePushed

func ShouldBranchBePushed(branchName string) bool

ShouldBranchBePushed returns whether the local branch with the given name contains commits that have not been pushed to the remote.

func ShouldNewBranchPush

func ShouldNewBranchPush() bool

ShouldNewBranchPush returns whether the current repository is configured to push freshly created branches up to the origin remote.

func UpdateCurrentBranchCache

func UpdateCurrentBranchCache(branchName string)

UpdateCurrentBranchCache clears the cache of the current branch. This should be called when a new branch is checked out

func UpdateGlobalShouldNewBranchPush

func UpdateGlobalShouldNewBranchPush(value bool)

UpdateGlobalShouldNewBranchPush updates global whether to push freshly created branches up to the origin remote.

func UpdateOffline

func UpdateOffline(value bool)

UpdateOffline updates whether Git Town is in offline mode

func UpdateShouldNewBranchPush

func UpdateShouldNewBranchPush(value bool)

UpdateShouldNewBranchPush updates whether the current repository is configured to push freshly created branches up to the origin remote.

func ValidateIsOnline

func ValidateIsOnline() error

ValidateIsOnline asserts that Git Town is not in offline mode

func ValidateIsRepository

func ValidateIsRepository() error

ValidateIsRepository asserts that the current directory is in a repository

Types

type ConfigMap

type ConfigMap struct {
	// contains filtered or unexported fields
}

ConfigMap represents the data from a call to `git config -l` or `git config -l --global`

func NewConfigMap

func NewConfigMap(global bool) *ConfigMap

NewConfigMap returns a new config map

func (*ConfigMap) Delete

func (c *ConfigMap) Delete(key string)

Delete deletes the given key

func (*ConfigMap) Get

func (c *ConfigMap) Get(key string) string

Get returns the value for the given key

func (*ConfigMap) KeysMatching

func (c *ConfigMap) KeysMatching(re *regexp.Regexp) (result []string)

KeysMatching returns the keys that match the given regexp

func (*ConfigMap) Reset

func (c *ConfigMap) Reset()

Reset resets the configuration map

func (*ConfigMap) Set

func (c *ConfigMap) Set(key, value string)

Set updates a key/value pair of the data

Jump to

Keyboard shortcuts

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