Documentation ¶
Index ¶
- Variables
- func GetAutomaticUpdateCheckSettings() (enabled bool, isSet bool)
- func GetCloneURL() (url string, branch string)
- func GetDefaultCloneBranch() string
- func GetDefaultCloneURL() string
- func GetUpdateCheckTimestamp() (t time.Time, isSet bool, err error)
- func MergeUpdates(cloneDir string, dryRun bool) (currentSHA string, err error)
- func RecordUpdateCheckTimestamp() error
- func ResetCloneBranch() error
- func ResetUpdateCheckTimestamp() error
- func RunUpdate(installDir string, acceptUpdate AcceptUpdateCallback, run func() error) (updateAvailable bool, accepted bool, err error)
- func RunUpdateOverExecutable(installDir string, execC cm.IExecContext, pipeSetup cm.PipeSetupFunc, ...) error
- func SetAutomaticUpdateCheckSettings(enable bool, reset bool) error
- func SetCloneBranch(branch string) error
- func SetCloneURL(url string, branch string) (err error)
- type AcceptUpdateCallback
- type Binaries
- type ReleaseStatus
- type RemoteCheckAction
Constants ¶
This section is empty.
Variables ¶
var DefaultRemote = "origin"
DefaultRemote is the default Git remote name.
Functions ¶
func GetAutomaticUpdateCheckSettings ¶
GetAutomaticUpdateCheckSettings gets the automatic update settings.
func GetCloneURL ¶
GetCloneURL get the clone url and clone branch.
func GetDefaultCloneBranch ¶
func GetDefaultCloneBranch() string
GetDefaultCloneBranch get the default clone branch.
func GetDefaultCloneURL ¶
func GetDefaultCloneURL() string
GetDefaultCloneURL get the default clone url.
func GetUpdateCheckTimestamp ¶
GetUpdateCheckTimestamp gets the update check time.
func MergeUpdates ¶
MergeUpdates merges updates in the Githooks clone directory. Only a fast-forward merge of the remote branch into the local branch is performed, no remote fetch is performed. Returns the commit SHA after the fast-forward.
func RecordUpdateCheckTimestamp ¶
func RecordUpdateCheckTimestamp() error
RecordUpdateCheckTimestamp records the current update check time.
func ResetCloneBranch ¶
func ResetCloneBranch() error
ResetCloneBranch resets the Githooks clone branch.
func ResetUpdateCheckTimestamp ¶
func ResetUpdateCheckTimestamp() error
ResetUpdateCheckTimestamp resets the update check time.
func RunUpdate ¶
func RunUpdate( installDir string, acceptUpdate AcceptUpdateCallback, run func() error) (updateAvailable bool, accepted bool, err error)
RunUpdate runs the procedure of updating Githooks.
func RunUpdateOverExecutable ¶
func RunUpdateOverExecutable( installDir string, execC cm.IExecContext, pipeSetup cm.PipeSetupFunc, args ...string) error
RunUpdateOverExecutbale executes the installer to run the update.
func SetAutomaticUpdateCheckSettings ¶
SetAutomaticUpdateCheckSettings set the automatic update settings.
func SetCloneBranch ¶
SetCloneBranch sets the Githooks clone branch.
func SetCloneURL ¶
SetCloneURL get the clone url and clone branch. The `branch` can be empty.
Types ¶
type AcceptUpdateCallback ¶
type AcceptUpdateCallback func(status *ReleaseStatus) bool
AcceptUpdateCallback is the callback type for accepting/rejecting updates.
func DefaultAcceptUpdateCallback ¶
func DefaultAcceptUpdateCallback( log cm.ILogContext, promptCtx prompt.IContext, acceptIfNoPrompt bool) AcceptUpdateCallback
DefaultAcceptUpdateCallback creates a default accept update callback which prompts the user.
type Binaries ¶
type Binaries struct { Cli string // The Githooks cli binary. Others []string // All other binaries except the cli binary. All []string // All binaries. BinDir string // Directory where all binaries reside. }
Binaries define all binaries used by githooks.
type ReleaseStatus ¶
type ReleaseStatus struct { RemoteURL string RemoteName string IsNewClone bool LocalCommitSHA string // Current local commit and corresponding to the current installed version. LocalTag string // Current local tag and corresponding to the current installed version. RemoteCommitSHA string // Remote head on the remote branch. IsUpdateAvailable bool UpdateCommitSHA string // The determined update SHA (always <= RemoteCommitSHA). UpdateTag string // The update tag. UpdateVersion *version.Version // The update version. UpdateInfo []string // The update info read from the commit. Branch string RemoteBranch string }
ReleaseStatus contains the status of the release clone.
func FetchUpdates ¶
func FetchUpdates( cloneDir string, url string, branch string, checkRemote bool, checkRemoteAction RemoteCheckAction, skipPrerelease bool) (status ReleaseStatus, err error)
FetchUpdates fetches updates in the Githooks clone directory. Arguments `url` and `branch` can be empty which triggers.
type RemoteCheckAction ¶
type RemoteCheckAction string
RemoteCheckAction is the action type for the remote check.
const ( // ErrorOnWrongRemote errors out if wrong remote detected. ErrorOnWrongRemote RemoteCheckAction = "error" // RecloneOnWrongRemote reclones if wrong remote detected. RecloneOnWrongRemote RemoteCheckAction = "reclone" )