hooks

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreReceiveHook  = "pre-receive"
	UpdateHook      = "update"
	PostReceiveHook = "post-receive"
	PostUpdateHook  = "post-update"
)

The names of git server-side hooks.

Variables

This section is empty.

Functions

func GenerateHooks

func GenerateHooks(_ context.Context, cfg *config.Config, repo string) error

GenerateHooks generates git server-side hooks for a repository. Currently, it supports the following hooks: - pre-receive - update - post-receive - post-update

This function should be called by the backend when a repository is created. TODO: support context.

Types

type HookArg

type HookArg struct {
	OldSha  string
	NewSha  string
	RefName string
}

HookArg is an argument to a git hook.

type Hooks

type Hooks interface {
	PreReceive(ctx context.Context, stdout io.Writer, stderr io.Writer, repo string, args []HookArg)
	Update(ctx context.Context, stdout io.Writer, stderr io.Writer, repo string, arg HookArg)
	PostReceive(ctx context.Context, stdout io.Writer, stderr io.Writer, repo string, args []HookArg)
	PostUpdate(ctx context.Context, stdout io.Writer, stderr io.Writer, repo string, args ...string)
}

Hooks provides an interface for git server-side hooks.

Jump to

Keyboard shortcuts

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