views

package
v0.0.0-...-60cfb24 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

This code comes from the go-git repository's unified encoder I've replicated it here so that I can access line types for rendering in HTML See https://github.com/go-git/go-git/blob/master/plumbing/format/diff/unified_encoder.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteBranch

func WriteBranch(branch *plumbing.Reference, repository *git.Repository, repositoryName string, baseDir string) error

func WriteCommits

func WriteCommits(repository *git.Repository, repositoryName string, baseDir string) error

func WriteIndex

func WriteIndex(branch *object.Commit, repository *git.Repository, repositoryName string, branchDir string, branchName string, treePrefix string) error

func WriteLog

func WriteLog(branch *object.Commit, repository *git.Repository, repositoryName string, hash plumbing.Hash, branchDir string, branchName string) error

func WriteRefs

func WriteRefs(repository *git.Repository, repositoryName string, baseDir string) error

func WriteTree

func WriteTree(branch *object.Commit, repository *git.Repository, repositoryName string, treeDir string, branchName string) error

Types

type AuthorData

type AuthorData struct {
	Name  string
	Email string
	Date  time.Time
}

type BaseData

type BaseData struct {
	Title       string
	Home        string
	StylePath   string
	FaviconPath string
	Nav         NavData
	Root        string
}

type BlobData

type BlobData struct {
	Lines     []string
	LineCount []int
	IsBinary  bool
	Markdown  template.HTML
}

type CommitData

type CommitData struct {
	Head      string
	Message   string
	Note      string
	Author    AuthorData
	Committer AuthorData
	Parents   []plumbing.Hash
	Notes     []NoteData
	Hash      plumbing.Hash
	Stats     object.FileStats
	Lines     Diff
}

type Diff

type Diff = []DiffBlock

type DiffBlock

type DiffBlock struct {
	Type DiffType
	Text string
}

type DiffBuilder

type DiffBuilder struct {
	// contains filtered or unexported fields
}

func NewDiffBuilder

func NewDiffBuilder() *DiffBuilder

func (*DiffBuilder) Add

func (self *DiffBuilder) Add(kind DiffType, text string)

func (*DiffBuilder) Append

func (self *DiffBuilder) Append(blocks ...DiffBlock)

func (*DiffBuilder) Diff

func (self *DiffBuilder) Diff() Diff

type DiffType

type DiffType = int
const (
	Context DiffType = iota
	Meta
	Frag
	Old
	New
)

type File

type File struct {
	Mode FileMode
	Size string
	Link string
}

type FileMode

type FileMode int8
const (
	EMPTY_E FileMode = iota
	DIR_E
	REGULAR_E
	DEPRECATED_E
	EXECUTABLE_E
	SYMLINK_E
	SUBMODULE_E
)

type LogCommit

type LogCommit struct {
	Hash    plumbing.Hash
	Author  string
	Date    time.Time
	Message string
	Refs    []ShortRef
	Stats   LogStats
}

type LogData

type LogData struct {
	Commits []LogCommit
}

type LogStats

type LogStats struct {
	Files     int
	Additions int
	Deletions int
}
type NavData struct {
	Commit string
	Branch string
}

type NoteData

type NoteData struct {
	Reference string
	Time      time.Time
	Hash      plumbing.Hash
	Blob      BlobData
}

type NoteMap

type NoteMap = map[string][]NoteData

type RefMap

type RefMap map[plumbing.Hash]ShortRef

type RefType

type RefType int8
const (
	BRANCH_E RefType = iota
	NOTE_E
	REMOTE_E
	TAG_E
	SYMBOLIC_E
	INVALID_E
)

type ShortRef

type ShortRef struct {
	Name string
	Type RefType
}

type TagData

type TagData struct {
	Name        string
	Target      plumbing.Hash
	IsAnnotated bool
	Head        string
	Tagger      string
	Date        time.Time
}

type TreeData

type TreeData struct {
	Readme   template.HTML
	Tree     map[string]File
	TreeName string
}

Jump to

Keyboard shortcuts

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