Documentation
¶
Overview ¶
Package hooks installs workline's git hooks.
Global mode takes core.hooksPath, which git honours for one folder only. So, like the forbidden-terms and git-identity-guard tools, it records whatever held core.hooksPath before and every hook hands over to it afterwards, then to the repository's own hooks. Nothing that ran before stops running.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Approve ¶
Approve asks a person whether the push goes, on the first channel that reaches one (ADR-0008): the terminal the hook opens; else the editor window the push came from; else a desktop dialog. None given by the pushing process: without any, no person can answer, and the push does not go.
func InstallGlobal ¶
InstallGlobal writes the dispatchers and points the global core.hooksPath at them, recording what was there before. Running it twice changes nothing.
func InstallRepo ¶
InstallRepo writes a commit-msg dispatcher in the repository's .githooks/, where it can be committed for the whole team.
func PushRanges ¶
PushRanges turns what git gives a pre-push hook on its standard input — "<local ref> <local sha> <remote ref> <remote sha>" per ref — into the ranges of commits the push sends, as `git log` reads them. A deleted ref sends nothing; a branch, new or not, sends the commits no ref of that remote holds.
func UninstallGlobal ¶
UninstallGlobal gives core.hooksPath back to whatever held it before.
Types ¶
type Paths ¶
type Paths struct {
Hooks string // folder core.hooksPath points to
Next string // file recording the previous core.hooksPath
}
Paths used by global mode.
func DefaultPaths ¶
DefaultPaths returns the folders under the user's config.
type Push ¶
type Push struct {
Repo, Remote string
Refs []Ref
// Via names the channels the person allows, among terminal, editor and
// dialog, in the order to try them; empty, all of them, in that order.
Via []string
}
Push is what the person is asked to approve.