Documentation
¶
Index ¶
Constants ¶
View Source
const ( TAG = iota + 1 PUSH FETCH PUSH_FORCE )
Possible event types
View Source
const VERSION = "1.0.0"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorNoAccess ¶
type ErrorNoAccess struct {
// Path to directory of repo accessed
Dir string
}
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 struct {
// Root directory to serve repos from
ProjectRoot string
// Path to git binary
GitBinPath string
// Access rules
UploadPack bool
ReceivePack bool
// Event handling functions
EventHandler func(ev Event)
// PathResolver allows you to customize the logic which maps request URLs to repository locations on disk. If nil, repository paths will be mapped directly to disk paths
PathResolver PathResolver
}
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 PathResolver ¶
type PathResolver func(info ResolveInfo) (string, error)
PathResolver resolves a request path to a relative path on disk.
type ResolveInfo ¶
type ResolveInfo struct {
// Path of the repo for the incoming request, this differs from Request.URL.Path because it will not include extra information such as /info/refs.
Path string
// Request that needs to be resolved is included in case you need parameters like host headers in order to resolve a repo path
Request *http.Request
}
ResolveInfo describes an incoming request that needs to be resolved to an on disk path
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.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.