Documentation ¶
Index ¶
Constants ¶
const ( TAG = iota + 1 PUSH FETCH PUSH_FORCE )
Possible event types
const VERSION = "1.3.0"
VERSION shows the git server version.
Variables ¶
var ErrMissingArgument = errors.New("insufficient factory options options provided")
ErrMissingArgument is to be returned if there are git server options missing that are passed to the factory.
Functions ¶
This section is empty.
Types ¶
type ErrorNoAccess ¶
type ErrorNoAccess struct { // Path to directory of repo accessed Dir string }
ErrorNoAccess is a error with the path to the requested repository
func (*ErrorNoAccess) Error ¶
func (e *ErrorNoAccess) Error() string
type Event ¶
type Event struct { // One of tag/push/fetch Type EventType `json:"type"` // SHA of commit Commit string `json:"commit"` // Path to bare repo Dir string // // // Set for pushes or tagging // // Tag string `json:"tag,omitempty"` Last string `json:"last,omitempty"` Branch string `json:"branch,omitempty"` // Error contains the error that happened (if any) // during this action/event Error error // Http stuff Request *http.Request }
An event (triggered on push/pull)
type GitHTTP ¶
type GitHTTP interface { Init() (*gitContext, error) ServeHTTP(w http.ResponseWriter, r *http.Request) }
GitHTTP exposes the interfaces of the git server.
func NewGitContext ¶
func NewGitContext(options GitOptions) (context GitHTTP, err error)
NewGitContext is the factory for the git server.
type GitOptions ¶
type GitOptions struct { // Root directory to serve repos from ProjectRoot string // Path to git binary GitBinPath string // Access rules UploadPack bool ReceivePack bool // Implicit generation AutoCreate bool // May be used to create a common context for the preprocessing funcs Prep func() Preprocesser // Event handling functions EventHandler func(ev Event) }
GitOptions contains the the git server options.
type GitReader ¶
type GitReader struct { // Underlying reader (to relay calls to) io.Reader // Error GitError error }
GitReader scans for errors in the output of a git command
type HandlerReq ¶
type Preprocesser ¶ added in v1.2.0
type Preprocesser struct { // Process updates the code. Process func(params *ProcessParams) error // Path checks if the requested uri is valid and returns a deterministic local repository path. Path func(rawPath string) (targetPath string, err error) }
Preprocesser is called on every git request.
func (*Preprocesser) IsPathNil ¶ added in v1.3.0
func (t *Preprocesser) IsPathNil() bool
IsPathNil returns true if a the Preprocesser struct or the IsPathNil func is nil.
func (*Preprocesser) IsProcessNil ¶ added in v1.3.0
func (t *Preprocesser) IsProcessNil() bool
IsProcessNil returns true if a the Preprocesser struct or the Process func is nil.
type ProcessParams ¶
type ProcessParams struct { // The public path to the git repository Repository string // Local path of the git repository where the files are located LocalPath string // If the repository has just been created IsNew bool }
ProcessParams contain the preprocessing parameters.
type RpcReader ¶
type RpcReader struct { // Underlying reader (to relay calls to). io.Reader // RPC type (receive-pack or upload-pack). Rpc string // List of events RpcReader has picked up through scanning. // These events do not have the Dir field set. Events []Event // contains filtered or unexported fields }
RpcReader scans for events in the incoming rpc request data.