git

package module
v0.0.0-...-ff0db3b Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2011 License: BSD-3-Clause Imports: 15 Imported by: 0

README

This is a Go package to read (and eventually modify) Git repositories. It's very much a work in progress, so it's not recommended for use by...anyone, really.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRepo

func IsRepo(dir string) bool

A git repository requires: - Either an objects directory or the GIT_OBJECT_DIRECTORY environment variable - A refs directory - Either a HEAD symlink or a HEAD file that is formatted properly

func ObjectFull

func ObjectFull(obj Object) []byte

Types

type Blob

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

func NewBlob

func NewBlob(raw []byte) *Blob

func (*Blob) Header

func (b *Blob) Header() string

func (*Blob) Raw

func (b *Blob) Raw() []byte

type Commit

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

func NewCommit

func NewCommit(authorName, authorEmail string, authorTime *time, committerName, committerEmail string, commitTime *time, tree Id, parents []Id, msg string) *Commit

func NewCommitSimple

func NewCommitSimple(name, email string, time *time, tree Id, parent Id) *Commit

func (*Commit) Header

func (c *Commit) Header() string

func (*Commit) Raw

func (c *Commit) Raw() []byte

type HttpHandler

type HttpHandler struct {
	Repo *Repo // the git repository to operate on
	// AllowDumb specifies whether or not to allow the "dumb" HTTP protocol.
	// This version of the protocol supports older clients, but can use
	// much more bandwidth than the "smart" version.
	AllowDumb bool
}

HttpHandler provides an interface to both smart and dumb HTTP protocols.

func (*HttpHandler) ServeHTTP

func (h *HttpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Id

type Id string

binary representation of an id len == 20, always (except for invalid ids) it's a string so it can be used as a map key

func IdFromBytes

func IdFromBytes(sha1 []byte) Id

func IdFromString

func IdFromString(sha1 string) Id

func ObjectId

func ObjectId(obj Object) Id

func (Id) String

func (id Id) String() string

type Object

type Object interface {
	Header() string
	Raw() []byte
}

type Repo

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

func InitRepo

func InitRepo(path string, bare bool) *Repo

Create .git directory Create empty .git/objects, .git/refs Create HEAD containing "ref: refs/heads/master"

func NewRepo

func NewRepo(path string) *Repo

func (*Repo) GetObject

func (r *Repo) GetObject(id Id) Object

func (*Repo) Head

func (r *Repo) Head() Id

Head returns the Id of the HEAD ref.

func (*Repo) Refs

func (r *Repo) Refs() map[string]Id

Refs returns a map of ref names to Ids.

func (*Repo) Save

func (r *Repo) Save(obj Object) os.Error

Save adds an Object to the repository.

type Tree

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

func NewTree

func NewTree(cap int) *Tree

func (*Tree) Add

func (t *Tree) Add(name string, child Id)

func (*Tree) Header

func (t *Tree) Header() string

func (*Tree) Raw

func (t *Tree) Raw() []byte

Jump to

Keyboard shortcuts

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