git

package
v0.0.0-...-aa46481 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LsBlob = iota
	LsTree
)

Tree object types

Variables

View Source
var ErrInvalidHash = errors.New("git: commit: not a hash")

ErrInvalidHash is used in gitweb to determine if the request error was from a bad request or happened running git.

View Source
var ErrNotExist = errors.New("git: show: file does not exist")

ErrNotExist is used in gitweb to determine if the request error was from a bad request or happened running git.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	CatFile  []byte
	DiffStat []byte
	Diff     []byte
}

Commit contains details about a commit.

type Git

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

Git is a wrapper for restricted git commands useful to gitweb.

func NewGit

func NewGit(path, ref string, timeout time.Duration) *Git

NewGit creates and initializes a new Git.

func (*Git) Commit

func (g *Git) Commit(hash string) (*Commit, error)

Commit retrieves details about a commit.

func (*Git) Log

func (g *Git) Log() ([]*LogItem, error)

Log retrieves the simple commit history.

func (*Git) Ls

func (g *Git) Ls() ([]*LsItem, error)

Ls retrieves the list of tracked files.

func (*Git) Ref

func (g *Git) Ref() string

Ref retrieves the current repository reference.

func (*Git) Show

func (g *Git) Show(file string) (show Show, err error)

Show retrieves the contents of a tracked file or mark as binary.

type LogItem

type LogItem struct {
	Time    time.Time
	Hash    string
	Name    string
	Subject string
	Stat    LogStat
}

LogItem is the parsed columnar output of git log.

type LogStat

type LogStat struct {
	Changed    uint64
	Insertions uint64
	Deletions  uint64
}

LogStat is the LogItem file diff stats.

type LsItem

type LsItem struct {
	Mode os.FileMode
	Type int
	Hash string
	Size int64
	Name string
}

LsItem is the parsed columnar output of git ls-tree.

type Show

type Show struct {
	Binary bool
	File   []byte
}

Show contains the contents of a file.

Jump to

Keyboard shortcuts

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