Documentation ¶
Overview ¶
This file is largely based on https://github.com/go-git/go-git/blob/70111361e674d786d3e8fca494229d0ad8361de9/plumbing/format/diff/unified_encoder.go Original code licensed under Apache 2.0
Index ¶
- Constants
- func AddConfigMiddleware(cfg SmithyConfig) gin.HandlerFunc
- func CommitView(ctx *gin.Context, urlParts []string)
- func DefaultParam(ctx *gin.Context, key, def string) string
- func Dispatch(ctx *gin.Context, routes []Route, fileSystemHandler http.Handler)
- func FormatChanges(changes object.Changes) (string, error)
- func FormatMarkdown(input string) string
- func GenerateDefaultConfig()
- func GetChanges(commit *object.Commit) (object.Changes, error)
- func GetReadmeFromCommit(commit *object.Commit) (*object.File, error)
- func Http404(ctx *gin.Context)
- func Http500(ctx *gin.Context)
- func IndexView(ctx *gin.Context, urlParts []string)
- func InitFileSystemHandler(smithyConfig SmithyConfig) http.Handler
- func ListBranches(r *git.Repository) ([]*plumbing.Reference, error)
- func ListTags(r *git.Repository) ([]*plumbing.Reference, error)
- func LogView(ctx *gin.Context, urlParts []string)
- func LogViewDefault(ctx *gin.Context, urlParts []string)
- func PatchHTML(p object.Patch) string
- func PatchView(ctx *gin.Context, urlParts []string)
- func PathExists(path string) (bool, error)
- func ReferenceCollector(it storer.ReferenceIter) ([]*plumbing.Reference, error)
- func RefsView(ctx *gin.Context, urlParts []string)
- func RenderSyntaxHighlighting(file *object.File) (string, error)
- func RepoGitView(ctx *gin.Context, urlParts []string)
- func RepoIndexView(ctx *gin.Context, urlParts []string)
- func StartServer(cfgFilePath string, debug bool)
- func TreeView(ctx *gin.Context, urlParts []string)
- type Commit
- type GitConfig
- type ReferenceByName
- type RepoConfig
- type RepositoryByName
- type RepositoryWithName
- type Route
- type SmithyConfig
- type StaticConfig
- type TreeEntry
- type UnifiedEncoder
Constants ¶
View Source
const DefaultContextLines = 3
DefaultContextLines is the default number of context lines.
View Source
const PAGE_SIZE int = 100
Variables ¶
This section is empty.
Functions ¶
func AddConfigMiddleware ¶
func AddConfigMiddleware(cfg SmithyConfig) gin.HandlerFunc
Make the config available to every request
func CommitView ¶
func FormatChanges ¶
FormatChanges spits out something similar to `git diff`
func FormatMarkdown ¶
func GenerateDefaultConfig ¶
func GenerateDefaultConfig()
func InitFileSystemHandler ¶
func InitFileSystemHandler(smithyConfig SmithyConfig) http.Handler
func ListBranches ¶
func LogViewDefault ¶
func PathExists ¶
func ReferenceCollector ¶
func ReferenceCollector(it storer.ReferenceIter) ([]*plumbing.Reference, error)
func RepoGitView ¶ added in v0.2.0
func RepoIndexView ¶
func StartServer ¶
Types ¶
type Commit ¶
func (*Commit) FormattedDate ¶
type GitConfig ¶
type GitConfig struct { Root string `yaml:"root"` Repos []RepoConfig `yaml:",omitempty"` // contains filtered or unexported fields }
type ReferenceByName ¶
func (ReferenceByName) Len ¶
func (r ReferenceByName) Len() int
func (ReferenceByName) Less ¶
func (r ReferenceByName) Less(i, j int) bool
func (ReferenceByName) Swap ¶
func (r ReferenceByName) Swap(i, j int)
type RepoConfig ¶
type RepositoryByName ¶
type RepositoryByName []RepositoryWithName
func (RepositoryByName) Len ¶
func (r RepositoryByName) Len() int
func (RepositoryByName) Less ¶
func (r RepositoryByName) Less(i, j int) bool
func (RepositoryByName) Swap ¶
func (r RepositoryByName) Swap(i, j int)
type RepositoryWithName ¶
type RepositoryWithName struct { Name string Repository *git.Repository Meta RepoConfig }
type Route ¶
func CompileRoutes ¶
func CompileRoutes() []Route
type SmithyConfig ¶
type SmithyConfig struct { Title string `yaml:"title"` Description string `yaml:"description"` Host string `yaml:"host"` Git GitConfig Static StaticConfig Templates struct { Dir string } Port int `yaml:"port"` }
func LoadConfig ¶
func LoadConfig(path string) (SmithyConfig, error)
func New ¶
func New() SmithyConfig
func (*SmithyConfig) FindRepo ¶
func (sc *SmithyConfig) FindRepo(slug string) (RepositoryWithName, bool)
func (*SmithyConfig) GetRepositories ¶
func (sc *SmithyConfig) GetRepositories() []RepositoryWithName
func (*SmithyConfig) LoadAllRepositories ¶
func (sc *SmithyConfig) LoadAllRepositories() error
type StaticConfig ¶ added in v0.2.0
type TreeEntry ¶
func ConvertTreeEntries ¶
type UnifiedEncoder ¶
UnifiedEncoder encodes an unified diff into the provided Writer. It does not support similarity index for renames or sorting hash representations.
func NewUnifiedEncoder ¶
func NewUnifiedEncoder(w io.Writer, contextLines int) *UnifiedEncoder
NewUnifiedEncoder returns a new UnifiedEncoder that writes to w.
Click to show internal directories.
Click to hide internal directories.