git

package module
v0.0.0-...-9b44dea Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2017 License: BSD-3-Clause Imports: 17 Imported by: 0

README

git

An unfinished Git client. It was used collect code samples on a system that didn't support git. It needs a lot of work.

Demo

cd github.com\as\git\ex\2
2.exe -s tcp!github.com!22 -k %publickeypath% -kp %publickeypassword%

Documentation

Overview

MACHINE GENERATED BY 'go generate' COMMAND TO EDIT A TYPE OR METHOD, COPY IT TO ANOTHER FILE IN THE PACKAGE

MACHINE GENERATED BY 'go generate' COMMAND TO EDIT A TYPE OR METHOD, COPY IT TO ANOTHER FILE IN THE PACKAGE

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHashLen = errors.New("hash not 20 bytes")
)

Functions

func Init

func Init(path string) (err error)

func ParseKeyValue

func ParseKeyValue(buf *bytes.Buffer, delim byte, key string, delim2 byte) (k string, v string, err error)

func TreeFromFile

func TreeFromFile(name string) (*tree, error)

Types

type Addr

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

type Blob

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

Blob is a git object. It stores file contents.

func (*Blob) Data

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

func (Blob) Eval

func (l Blob) Eval() (Object, error)

Eval evaluates a leaf (object) and returns and interface to that object.

func (*Blob) Hash

func (b *Blob) Hash() Hash

func (*Blob) Name

func (b *Blob) Name() string

func (*Blob) ReadBinary

func (b *Blob) ReadBinary(r io.Reader) (err error)

func (Blob) String

func (z Blob) String() (s string)

func (Blob) WriteBinary

func (z Blob) WriteBinary(w io.Writer) (err error)

type Cmd

type Cmd struct {
	Name string
	Args []string

	Session *ssh.Session
	// contains filtered or unexported fields
}

func (*Cmd) Start

func (c *Cmd) Start() error

func (*Cmd) UploadPackRX

func (c *Cmd) UploadPackRX() (ph *packhdr, err error)

func (*Cmd) UploadPackTX

func (c *Cmd) UploadPackTX() (*PackList, error)

type Commit

type Commit struct {
	Tree      *Tree
	Parent    *Commit
	Author    ID
	Committer ID
	Comment   string
}

func ParseCommit

func ParseCommit(r io.Reader) (c *Commit, err error)

type Git

type Git struct {
	*ssh.Client
}

func (*Git) Command

func (g *Git) Command(name string, args ...string) (*Cmd, error)

type Hash

type Hash string

func HashData

func HashData(p []byte) (Hash, error)

func ParseHash

func ParseHash(p [20]byte) Hash

func ParseHashString

func ParseHashString(h string) (Hash, error)

func (Hash) Bytes

func (h Hash) Bytes() ([]byte, error)

func (Hash) String

func (h Hash) String() string

type Hashref

type Hashref struct {
	Hash, Ref string
}

type ID

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

type Info

type Info struct {
	PackType
	Size int
}

func (*Info) ReadBinary

func (a *Info) ReadBinary(r io.Reader) (err error)

func (*Info) Uvarint

func (a *Info) Uvarint(buf []byte) (uint64, int)

func (*Info) WriteBinary

func (a *Info) WriteBinary(w io.Writer) error

type Object

type Object interface {
	Hash() Hash
	Data() []byte
}

Object represnets a file's contents stored as a sha1 hash

type Options

type Options []string

func (Options) Done

func (o Options) Done() string

func (Options) Flush

func (o Options) Flush() string

func (Options) String

func (o Options) String() string

func (Options) Want

func (o Options) Want(hash string) string

type PackList

type PackList struct {
	Refmap map[string]Hashref
	// contains filtered or unexported fields
}

func (*PackList) Print

func (p *PackList) Print()

func (*PackList) Read

func (p *PackList) Read(r io.Reader) error

type PackType

type PackType uint64
const (
	PackCommit PackType
	PackTree
	PackBlob
	PackTag

	PackOffDelta
	PackRefDelta
)

func (PackType) Describe

func (p PackType) Describe() string

type Ref

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

func ParseRef

func ParseRef(b *bytes.Buffer) (r Ref, err error)

ParseRef parses a named hash reference from the byte buffer.

type Repo

type Repo struct {
	*fs.Fs
}

func NewRepo

func NewRepo(path string) *Repo

func (*Repo) Eval

func (r *Repo) Eval(key string) (Object, error)

type Tree

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

func (*Tree) Data

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

func (*Tree) Hash

func (t *Tree) Hash() Hash

func (Tree) Leaves

func (t Tree) Leaves() []*leaf

func (*Tree) ReadBinary

func (z *Tree) ReadBinary(r io.Reader) (err error)

func (*Tree) String

func (z *Tree) String() (s string)

func (*Tree) WriteBinary

func (z *Tree) WriteBinary(w io.Writer) (err error)

type Until

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

func (Until) Read

func (u Until) Read(r io.Reader) (p []byte, err error)

Directories

Path Synopsis
ex
2
Example git driver
Example git driver

Jump to

Keyboard shortcuts

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